rainbowindex 0.2.2 → 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/CHANGELOG.md +27 -14
- package/LICENSE +1 -1
- package/README.md +1 -2
- package/dist/{chunk-CUUW2K35.mjs → chunk-AUWGHSTO.mjs} +2 -2
- package/dist/{chunk-FHATRQMN.mjs → chunk-AZXWJ625.mjs} +1 -1
- package/dist/{chunk-W6XIBM4M.mjs → chunk-IE6N76PW.mjs} +11 -1
- package/dist/{chunk-KYDEHYIE.mjs → chunk-RHOQSN2B.mjs} +1 -1
- package/dist/cli.mjs +7 -7
- package/dist/editor.d.ts +8 -0
- package/dist/editor.mjs +10 -7
- package/dist/index.mjs +3 -3
- package/dist/vite.mjs +3 -3
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,33 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [0.3.0] - 2026-08-14
|
|
9
|
+
|
|
10
|
+
### Added — editor tooling API (phase 2)
|
|
11
|
+
|
|
12
|
+
- **`ClassCandidate.callId`** — helper/safelist candidates now carry the
|
|
13
|
+
identity of the call they were collected from: candidates from the same
|
|
14
|
+
call share one id, distinct calls get distinct ids. This is the grouping
|
|
15
|
+
key merge tooling needs to run `analyzeMerge()` over one `ri(…)` call's
|
|
16
|
+
classes without mixing neighbouring calls. Feature-detect via the new
|
|
17
|
+
`"candidate-call-ids"` entry in `editorCapabilities`.
|
|
18
|
+
- **`ri()` joins the scanned class helpers** — the scanner now walks `ri(…)`
|
|
19
|
+
calls like `clsx`/`cn`/`twMerge`, so their arguments get `helper` origin,
|
|
20
|
+
a helper name, and a call id (previously they were only caught by the
|
|
21
|
+
whole-file literal scan as `plain` candidates). `CLASS_HELPER_NAMES`
|
|
22
|
+
includes `"ri"` accordingly.
|
|
23
|
+
- **Value typos get suggestions** — the class inspector's suggestion corpus
|
|
24
|
+
now includes the enumerated completion universe, so `validate()` suggests
|
|
25
|
+
concrete neighbours for functional-value typos (`bg-blu-500` →
|
|
26
|
+
`bg-blue-500`, `bg-thme-500` → `bg-theme-500`) instead of staying silent.
|
|
27
|
+
|
|
28
|
+
### Fixed
|
|
29
|
+
|
|
30
|
+
- **`--optimize` CLI flag** — the README documented `--optimize` but the CLI
|
|
31
|
+
rejected it with "Unknown option". It is now accepted as an alias of
|
|
32
|
+
`--minify` (both run the same LightningCSS minification +
|
|
33
|
+
browser-fallback pass).
|
|
34
|
+
|
|
8
35
|
## [0.2.2] - 2026-08-13
|
|
9
36
|
|
|
10
37
|
### Added — editor tooling API (phase 1)
|
|
@@ -132,20 +159,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
132
159
|
imports rather than relying on tree-shaking. The barrel re-exports the
|
|
133
160
|
model, so existing importers are unaffected.
|
|
134
161
|
|
|
135
|
-
### Fixed
|
|
136
|
-
|
|
137
|
-
- **Dep-advertised `safelistSources` were silently dropped in standard
|
|
138
|
-
install layouts** — auto-discovered safelist patterns resolve to absolute
|
|
139
|
-
paths inside the consumer's `node_modules`, but were globbed in the pass
|
|
140
|
-
that carries the default `node_modules/**` exclude, so they matched
|
|
141
|
-
nothing whenever the dep's real path sat inside the project root — i.e.
|
|
142
|
-
every plain npm/yarn/pnpm install. They now go through the same relaxed
|
|
143
|
-
second glob pass as explicit `@source "node_modules/…"` patterns, which
|
|
144
|
-
drops only that one exclude. (Tests previously passed on macOS only
|
|
145
|
-
because the symlinked tmpdir placed fixture deps outside the literal cwd,
|
|
146
|
-
dodging the cwd-relative exclude; fixtures now realpath the tmp root so
|
|
147
|
-
every platform exercises the real geometry.)
|
|
148
|
-
|
|
149
162
|
## [0.2.1] - 2026-07-28
|
|
150
163
|
|
|
151
164
|
### Added — diagnostics
|
package/LICENSE
CHANGED
|
@@ -19,4 +19,4 @@ Software.
|
|
|
19
19
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
|
|
20
20
|
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
|
21
21
|
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
|
22
|
-
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
22
|
+
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/README.md
CHANGED
|
@@ -80,8 +80,7 @@ Common flags:
|
|
|
80
80
|
| --- | --- |
|
|
81
81
|
| `-o`, `--output <file>` | Output CSS file path. Required with `--watch`. |
|
|
82
82
|
| `--watch` | Re-run on source-file changes (chokidar). |
|
|
83
|
-
| `--minify` |
|
|
84
|
-
| `--optimize` | Minification + browser-fallback passes. |
|
|
83
|
+
| `--minify` | Minification + browser-fallback passes via LightningCSS. `--optimize` is an accepted alias. |
|
|
85
84
|
| `--css <file>` | CSS input with directives. Auto-detected if omitted. |
|
|
86
85
|
| `--strict` | Drop the string escape hatch in generated types. |
|
|
87
86
|
| `--template <name>` | Vite template to scaffold (default: `react-ts`). |
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
finalizeProjectCompilation,
|
|
4
4
|
resolveGoogleFonts,
|
|
5
5
|
validateGlobPattern
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-AZXWJ625.mjs";
|
|
7
7
|
import {
|
|
8
8
|
APPLY_ALIASES,
|
|
9
9
|
DEFAULT_PROPERTY_GROUP,
|
|
@@ -23,7 +23,7 @@ import {
|
|
|
23
23
|
pushWarningsDeduped,
|
|
24
24
|
resolveUtilityDeclarations,
|
|
25
25
|
resolveVariant
|
|
26
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-IE6N76PW.mjs";
|
|
27
27
|
|
|
28
28
|
// src/integrations/postcss/index.ts
|
|
29
29
|
import postcss from "postcss";
|
|
@@ -2138,6 +2138,7 @@ var CLASS_HELPERS = [
|
|
|
2138
2138
|
"classnames",
|
|
2139
2139
|
"classNames",
|
|
2140
2140
|
"cx",
|
|
2141
|
+
"ri",
|
|
2141
2142
|
"twJoin",
|
|
2142
2143
|
"twMerge"
|
|
2143
2144
|
];
|
|
@@ -2183,7 +2184,13 @@ var CandidateCollector = class {
|
|
|
2183
2184
|
}
|
|
2184
2185
|
markContext(start, end) {
|
|
2185
2186
|
if (this.origin === "plain" || end <= start) return;
|
|
2186
|
-
this.contexts.push({
|
|
2187
|
+
this.contexts.push({
|
|
2188
|
+
start,
|
|
2189
|
+
end,
|
|
2190
|
+
origin: this.origin,
|
|
2191
|
+
helper: this.helperName,
|
|
2192
|
+
id: this.contexts.length
|
|
2193
|
+
});
|
|
2187
2194
|
}
|
|
2188
2195
|
add(value, start, end, prefixStart, prefixEnd) {
|
|
2189
2196
|
const key = `${start}:${end}:${value}`;
|
|
@@ -2214,6 +2221,9 @@ var CandidateCollector = class {
|
|
|
2214
2221
|
if (best) {
|
|
2215
2222
|
candidate.origin = best.origin;
|
|
2216
2223
|
if (best.helper) candidate.helperName = best.helper;
|
|
2224
|
+
if (best.origin === "helper" || best.origin === "safelist") {
|
|
2225
|
+
candidate.callId = best.id;
|
|
2226
|
+
}
|
|
2217
2227
|
}
|
|
2218
2228
|
}
|
|
2219
2229
|
}
|
package/dist/cli.mjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import {
|
|
3
3
|
CSS_ENTRY_CANDIDATES,
|
|
4
4
|
enumerateClassNames
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-RHOQSN2B.mjs";
|
|
6
6
|
import {
|
|
7
7
|
DEFAULT_EXCLUDES,
|
|
8
8
|
DEFAULT_PATTERNS,
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
getFontPreloadLinks,
|
|
12
12
|
resolveGoogleFonts,
|
|
13
13
|
validateGlobPattern
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-AZXWJ625.mjs";
|
|
15
15
|
import {
|
|
16
16
|
MAX_DIRECTIVE_INPUT_SIZE,
|
|
17
17
|
analyzeProjectCSS,
|
|
@@ -20,7 +20,7 @@ import {
|
|
|
20
20
|
hasRIActivation,
|
|
21
21
|
listVariants,
|
|
22
22
|
resolveDirectives
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-IE6N76PW.mjs";
|
|
24
24
|
import {
|
|
25
25
|
devWarn
|
|
26
26
|
} from "./chunk-SOMDX7V6.mjs";
|
|
@@ -109,7 +109,7 @@ function parseArgs(argv, callbacks) {
|
|
|
109
109
|
i++;
|
|
110
110
|
continue;
|
|
111
111
|
}
|
|
112
|
-
if (arg === "--minify") {
|
|
112
|
+
if (arg === "--minify" || arg === "--optimize") {
|
|
113
113
|
opts.minify = true;
|
|
114
114
|
i++;
|
|
115
115
|
continue;
|
|
@@ -176,7 +176,7 @@ Usage:
|
|
|
176
176
|
Options:
|
|
177
177
|
-o, --output <file> Output CSS file path (omit to write to stdout)
|
|
178
178
|
--watch Re-run on source-file changes (requires --output)
|
|
179
|
-
--minify Minify
|
|
179
|
+
--minify Minify + browser fallbacks via LightningCSS (alias: --optimize)
|
|
180
180
|
--css <file> CSS input with directives (auto-detected if omitted)
|
|
181
181
|
-h, --help Show this help
|
|
182
182
|
|
|
@@ -291,7 +291,7 @@ Run \`rainbowindex <subcommand> --help\` for subcommand-specific options.
|
|
|
291
291
|
Options:
|
|
292
292
|
-o, --output <file> Output CSS file path
|
|
293
293
|
--watch Watch for changes
|
|
294
|
-
--minify Minify
|
|
294
|
+
--minify Minify + browser fallbacks via LightningCSS (alias: --optimize)
|
|
295
295
|
--css <file> CSS file with directives (default: auto-detect)
|
|
296
296
|
--template <name> Vite template for create (default: react-ts)
|
|
297
297
|
--strict No string escape hatch in generated types
|
|
@@ -1233,7 +1233,7 @@ function readPackageJSONSync(cwd) {
|
|
|
1233
1233
|
|
|
1234
1234
|
// src/entries/cli.ts
|
|
1235
1235
|
function getVersion() {
|
|
1236
|
-
return true ? "0.
|
|
1236
|
+
return true ? "0.3.0" : "unknown";
|
|
1237
1237
|
}
|
|
1238
1238
|
async function main() {
|
|
1239
1239
|
const args = process.argv.slice(2);
|
package/dist/editor.d.ts
CHANGED
|
@@ -27,6 +27,14 @@ interface ClassCandidate {
|
|
|
27
27
|
origin: CandidateOrigin;
|
|
28
28
|
/** The call the class was found in, when origin is "helper"/"safelist". */
|
|
29
29
|
helperName?: string;
|
|
30
|
+
/** Identity of the innermost scanned helper/safelist call context:
|
|
31
|
+
* candidates from the same call share one id, distinct calls get distinct
|
|
32
|
+
* ids. A class helper nested inside another class helper's arguments is
|
|
33
|
+
* not scanned as its own call — its literals belong to the outer call —
|
|
34
|
+
* while a class helper inside a cva/tv config does get its own id. Ids
|
|
35
|
+
* are only comparable within one extraction's result. Absent for
|
|
36
|
+
* attribute/plain candidates. */
|
|
37
|
+
callId?: number;
|
|
30
38
|
/** For variant-group members: span of the group's variant prefix (`hover:`). */
|
|
31
39
|
groupPrefix?: {
|
|
32
40
|
start: number;
|
package/dist/editor.mjs
CHANGED
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
CSS_ENTRY_CANDIDATES,
|
|
3
3
|
UTILITY_VALUE_SPACES,
|
|
4
4
|
enumerateClassNames
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-RHOQSN2B.mjs";
|
|
6
6
|
import {
|
|
7
7
|
CLASS_HELPER_NAMES,
|
|
8
8
|
RI_IMPORT_SPECIFIERS,
|
|
@@ -25,7 +25,7 @@ import {
|
|
|
25
25
|
parseUtility,
|
|
26
26
|
severityForCode,
|
|
27
27
|
warningCode
|
|
28
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-IE6N76PW.mjs";
|
|
29
29
|
import {
|
|
30
30
|
analyzeMerge,
|
|
31
31
|
computeDarkStop,
|
|
@@ -63,10 +63,12 @@ function createClassInspector(theme) {
|
|
|
63
63
|
}
|
|
64
64
|
function utilitySuggestionCorpus() {
|
|
65
65
|
if (!utilityCorpus) {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
66
|
+
const names = new Set(STATIC_UTILITIES);
|
|
67
|
+
for (const custom of theme.customUtilities) {
|
|
68
|
+
if (!custom.functional) names.add(custom.name);
|
|
69
|
+
}
|
|
70
|
+
for (const entry of enumerateClassNames(theme).classes) names.add(entry.name);
|
|
71
|
+
utilityCorpus = [...names];
|
|
70
72
|
}
|
|
71
73
|
return utilityCorpus;
|
|
72
74
|
}
|
|
@@ -352,10 +354,11 @@ function createEditorSession(options = {}) {
|
|
|
352
354
|
}
|
|
353
355
|
|
|
354
356
|
// src/entries/editor.ts
|
|
355
|
-
var version = true ? "0.
|
|
357
|
+
var version = true ? "0.3.0" : "0.0.0-dev";
|
|
356
358
|
var EDITOR_API_VERSION = 1;
|
|
357
359
|
var editorCapabilities = Object.freeze([
|
|
358
360
|
"class-candidates",
|
|
361
|
+
"candidate-call-ids",
|
|
359
362
|
"css-entry-detection",
|
|
360
363
|
"theme-analysis",
|
|
361
364
|
"class-inspection",
|
package/dist/index.mjs
CHANGED
|
@@ -3,17 +3,17 @@ import {
|
|
|
3
3
|
} from "./chunk-PD4ZXGJ6.mjs";
|
|
4
4
|
import {
|
|
5
5
|
postcss_default
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-AUWGHSTO.mjs";
|
|
7
7
|
import {
|
|
8
8
|
finalizeProjectCompilation,
|
|
9
9
|
resolveGoogleFonts
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-AZXWJ625.mjs";
|
|
11
11
|
import {
|
|
12
12
|
analyzeProjectCSS,
|
|
13
13
|
createCompiler,
|
|
14
14
|
extractClassesFromSource,
|
|
15
15
|
pushWarningsDeduped
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-IE6N76PW.mjs";
|
|
17
17
|
import {
|
|
18
18
|
DEFAULT_TEXT_SIZES,
|
|
19
19
|
createCompilationContext,
|
package/dist/vite.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
postcss_default
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
3
|
+
} from "./chunk-AUWGHSTO.mjs";
|
|
4
|
+
import "./chunk-AZXWJ625.mjs";
|
|
5
5
|
import {
|
|
6
6
|
expandApplyGroups,
|
|
7
7
|
findClosingBrace,
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
isAtRuleBoundary,
|
|
10
10
|
isAtRuleNameChar,
|
|
11
11
|
isSourceFile
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-IE6N76PW.mjs";
|
|
13
13
|
import {
|
|
14
14
|
devWarn
|
|
15
15
|
} from "./chunk-SOMDX7V6.mjs";
|