@cassida/vite-plugin 0.1.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 ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 FSS contributors
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.
@@ -0,0 +1,26 @@
1
+ import { type CassConfig, type CassPlugin, type Registry } from '@cassida/compiler';
2
+ import type { Plugin } from 'vite';
3
+ /**
4
+ * Plugin options exposed to `vite.config.ts`. Anything declared in
5
+ * `CassConfig` (the JSON-serializable shape) can also live in a
6
+ * `cassida.config.json` at the project root; plugin options take precedence
7
+ * over the file. `registry` and `include` are runtime-only and have no
8
+ * file-config equivalent.
9
+ */
10
+ export interface CassPluginOptions extends CassConfig {
11
+ readonly registry?: Registry;
12
+ readonly include?: RegExp;
13
+ /**
14
+ * Build-time FSS plugins (e.g. `@cassida/plugin-hover-fix`). Each
15
+ * plugin receives the post-collapse `ScopeBag` tree and returns a
16
+ * new one; the className is derived from the post-plugin form. So
17
+ * enabling or disabling a plugin will change every affected hash —
18
+ * caches invalidate cleanly.
19
+ *
20
+ * Plugins are not config-file serializable (they're functions), so
21
+ * this option lives on the inline plugin options only.
22
+ */
23
+ readonly plugins?: readonly CassPlugin[];
24
+ }
25
+ export default function cassida(options?: CassPluginOptions): Plugin;
26
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAKA,OAAO,EAML,KAAK,UAAU,EACf,KAAK,UAAU,EACf,KAAK,QAAQ,EAEd,MAAM,mBAAmB,CAAC;AAE3B,OAAO,KAAK,EAAE,MAAM,EAAiB,MAAM,MAAM,CAAC;AAalD;;;;;;GAMG;AACH,MAAM,WAAW,iBAAkB,SAAQ,UAAU;IACnD,QAAQ,CAAC,QAAQ,CAAC,EAAE,QAAQ,CAAC;IAC7B,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B;;;;;;;;;OASG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,SAAS,UAAU,EAAE,CAAC;CAC1C;AAED,MAAM,CAAC,OAAO,UAAU,OAAO,CAAC,OAAO,GAAE,iBAAsB,GAAG,MAAM,CAkHvE"}
package/dist/index.js ADDED
@@ -0,0 +1,214 @@
1
+ import { existsSync, readFileSync } from 'node:fs';
2
+ import { resolve } from 'node:path';
3
+ import browserslist from 'browserslist';
4
+ import { browserslistToTargets, transform as lightningTransform } from 'lightningcss';
5
+ import { CssEmitter, defaultRegistry, mergeConfig, parseCassConfig, } from '@cassida/compiler';
6
+ import { transform } from '@cassida/parser';
7
+ /**
8
+ * One virtual CSS module per source file, keyed by the file's resolved id.
9
+ * The plugin injects an `import "virtual:cassida.css?file=<encoded id>"` at the
10
+ * top of every transformed JSX file, so the CSS for that file is loaded
11
+ * by Rollup *after* its transform completes — which sidesteps the load /
12
+ * transform race that a single shared virtual module suffers in build mode.
13
+ */
14
+ const VIRTUAL_PREFIX = 'virtual:cassida.css?file=';
15
+ const RESOLVED_PREFIX = '\0' + VIRTUAL_PREFIX;
16
+ const CONFIG_FILENAME = 'cassida.config.json';
17
+ export default function cassida(options = {}) {
18
+ const include = options.include ?? /\.[jt]sx$/;
19
+ const registry = options.registry ?? defaultRegistry;
20
+ // Filled in `configResolved`; until then we use the in-memory defaults
21
+ // so unit-test usages without a Vite config still work.
22
+ let resolved = mergeConfig(extractConfig(options));
23
+ const rulesByFile = new Map();
24
+ let server;
25
+ // lightningcss `Targets` are derived once per plugin instance from
26
+ // either the explicit config string or auto-discovered browserslist
27
+ // queries. `null` means "no targets passed → lightningcss default".
28
+ let cachedTargets = null;
29
+ let projectRoot = process.cwd();
30
+ function emitForFile(file) {
31
+ const rules = rulesByFile.get(file);
32
+ if (!rules || rules.length === 0)
33
+ return '';
34
+ const emitter = new CssEmitter({
35
+ layer: resolved.layer,
36
+ mediaSort: resolved.media.sort,
37
+ });
38
+ for (const r of rules)
39
+ emitter.add(r);
40
+ const css = emitter.emit();
41
+ if (!resolved.css.lightningcss.enabled || css === '')
42
+ return css;
43
+ return postProcessLightningCss(css, file, resolved, cachedTargets);
44
+ }
45
+ function virtualIdFor(file) {
46
+ return VIRTUAL_PREFIX + encodeURIComponent(file);
47
+ }
48
+ function invalidateVirtualForFile(file) {
49
+ if (!server)
50
+ return;
51
+ const resolvedId = '\0' + virtualIdFor(file);
52
+ const mod = server.moduleGraph.getModuleById(resolvedId);
53
+ if (!mod)
54
+ return;
55
+ server.moduleGraph.invalidateModule(mod);
56
+ const path = virtualIdFor(file);
57
+ server.ws.send({
58
+ type: 'update',
59
+ updates: [
60
+ {
61
+ type: 'js-update',
62
+ path,
63
+ acceptedPath: path,
64
+ timestamp: Date.now(),
65
+ },
66
+ ],
67
+ });
68
+ }
69
+ return {
70
+ name: 'cassida',
71
+ enforce: 'pre',
72
+ configResolved(viteConfig) {
73
+ projectRoot = viteConfig.root;
74
+ const fileCfg = loadFileConfig(projectRoot);
75
+ // Resolution priority: defaults < cassida.config.json < plugin options.
76
+ resolved = mergeConfig(fileCfg, extractConfig(options));
77
+ cachedTargets = resolveTargets(resolved.css.lightningcss.targets, projectRoot);
78
+ },
79
+ configureServer(s) {
80
+ server = s;
81
+ },
82
+ resolveId(id) {
83
+ if (id.startsWith(VIRTUAL_PREFIX))
84
+ return '\0' + id;
85
+ return null;
86
+ },
87
+ load(id) {
88
+ if (id.startsWith(RESOLVED_PREFIX)) {
89
+ const file = decodeURIComponent(id.slice(RESOLVED_PREFIX.length));
90
+ return emitForFile(file);
91
+ }
92
+ return null;
93
+ },
94
+ transform(code, id) {
95
+ const cleanId = id.split('?')[0] ?? id;
96
+ if (!include.test(cleanId))
97
+ return null;
98
+ if (!code.includes(resolved.importSource))
99
+ return null;
100
+ const result = transform(code, {
101
+ registry,
102
+ filename: cleanId,
103
+ importSource: resolved.importSource,
104
+ shorthandPolicy: resolved.shorthand.policy,
105
+ ...(options.plugins ? { plugins: options.plugins } : {}),
106
+ });
107
+ if (!result.transformed) {
108
+ if (rulesByFile.delete(cleanId))
109
+ invalidateVirtualForFile(cleanId);
110
+ return null;
111
+ }
112
+ rulesByFile.set(cleanId, result.rules);
113
+ invalidateVirtualForFile(cleanId);
114
+ const importStmt = `import ${JSON.stringify(virtualIdFor(cleanId))};\n`;
115
+ return {
116
+ code: importStmt + result.code,
117
+ // Babel's source map shape conforms to Rollup's SourceMapInput
118
+ // structurally, but rollup's types aren't a direct dep here so
119
+ // we type-launder to `never` (the bottom type, assignable to
120
+ // anything). This is a known idiom for Vite plugin map fields.
121
+ map: result.map,
122
+ };
123
+ },
124
+ };
125
+ }
126
+ /**
127
+ * Extract the JSON-friendly config slice from plugin options and run
128
+ * it through the same Zod validator as `cassida.config.json`. Drops
129
+ * runtime-only fields (`registry`, `include`) so the result can be
130
+ * fed cleanly into `mergeConfig`. Inline options receive the same
131
+ * validation guarantees as the file: typos and out-of-range values
132
+ * surface as a single error at plugin construction time.
133
+ */
134
+ function extractConfig(options) {
135
+ const { registry, include, plugins, ...cfg } = options;
136
+ void registry;
137
+ void include;
138
+ void plugins;
139
+ if (Object.keys(cfg).length === 0)
140
+ return undefined;
141
+ return parseCassConfig(cfg, '<vite.config.ts plugin options>');
142
+ }
143
+ /**
144
+ * Run the emitter's CSS string through lightningcss for autoprefixing,
145
+ * minification (when `minify: true`), and target-aware downleveling.
146
+ *
147
+ * `@property` rules are preserved through this pass — lightningcss
148
+ * supports the Houdini descriptor natively. We additionally split the
149
+ * input so emitter-emitted property declarations are processed in the
150
+ * same pass as the `@layer` block; they share a single document.
151
+ */
152
+ function postProcessLightningCss(css, filename, resolved, targets) {
153
+ const result = lightningTransform({
154
+ filename,
155
+ code: Buffer.from(css, 'utf-8'),
156
+ minify: resolved.css.lightningcss.minify,
157
+ ...(targets ? { targets } : {}),
158
+ });
159
+ return Buffer.from(result.code).toString('utf-8');
160
+ }
161
+ /**
162
+ * Resolve a `Targets` object from the user's config, or fall back to
163
+ * auto-discovering a browserslist query from the project root
164
+ * (`.browserslistrc`, `package.json#browserslist`, or environment
165
+ * defaults). Returning `null` lets lightningcss apply its own default.
166
+ *
167
+ * The `'defaults'` literal in `defaultConfig` is treated as "no
168
+ * explicit override given, please auto-discover" — only when the user
169
+ * actually puts a different string in the config (or the auto-
170
+ * discovery picks up a project file) do we set explicit targets.
171
+ */
172
+ function resolveTargets(configTargets, root) {
173
+ // `'defaults'` is the synthetic placeholder coming from the resolved
174
+ // config defaults; treat it as "no explicit user choice" and let
175
+ // browserslist read project files first.
176
+ if (configTargets !== 'defaults') {
177
+ const queries = browserslist(configTargets);
178
+ return browserslistToTargets(queries);
179
+ }
180
+ try {
181
+ const queries = browserslist(undefined, { path: root });
182
+ if (queries.length === 0)
183
+ return null;
184
+ return browserslistToTargets(queries);
185
+ }
186
+ catch {
187
+ // No project browserslist + no explicit env defaults — let
188
+ // lightningcss decide.
189
+ return null;
190
+ }
191
+ }
192
+ function loadFileConfig(root) {
193
+ const path = resolve(root, CONFIG_FILENAME);
194
+ if (!existsSync(path))
195
+ return undefined;
196
+ let raw;
197
+ try {
198
+ raw = readFileSync(path, 'utf-8');
199
+ }
200
+ catch (e) {
201
+ throw new Error(`[cassida] failed to read ${path}: ${e.message}`);
202
+ }
203
+ let json;
204
+ try {
205
+ json = JSON.parse(raw);
206
+ }
207
+ catch (e) {
208
+ throw new Error(`[cassida] failed to parse ${path}: ${e.message}`);
209
+ }
210
+ // Zod-validated at the I/O boundary — typos in the file surface as
211
+ // build-time errors with a precise field path.
212
+ return parseCassConfig(json, path);
213
+ }
214
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,YAAY,MAAM,cAAc,CAAC;AACxC,OAAO,EAAE,qBAAqB,EAAE,SAAS,IAAI,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAEtF,OAAO,EACL,UAAU,EACV,eAAe,EACf,WAAW,EACX,eAAe,GAMhB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAG5C;;;;;;GAMG;AACH,MAAM,cAAc,GAAG,2BAA2B,CAAC;AACnD,MAAM,eAAe,GAAG,IAAI,GAAG,cAAc,CAAC;AAC9C,MAAM,eAAe,GAAG,qBAAqB,CAAC;AAyB9C,MAAM,CAAC,OAAO,UAAU,OAAO,CAAC,UAA6B,EAAE;IAC7D,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,IAAI,WAAW,CAAC;IAC/C,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAQ,IAAI,eAAe,CAAC;IAErD,uEAAuE;IACvE,wDAAwD;IAC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EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;QACxD,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC;YAAE,OAAO,IAAI,CAAC;QACtC,OAAO,qBAAqB,CAAC,OAAO,CAAC,CAAC;IACxC,CAAC;IAAC,MAAM,CAAC;QACP,2DAA2D;QAC3D,uBAAuB;QACvB,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC;AAED,SAAS,cAAc,CAAC,IAAY;IAClC,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,EAAE,eAAe,CAAC,CAAC;IAC5C,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC;QAAE,OAAO,SAAS,CAAC;IACxC,IAAI,GAAW,CAAC;IAChB,IAAI,CAAC;QACH,GAAG,GAAG,YAAY,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IACpC,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,MAAM,IAAI,KAAK,CACb,4BAA4B,IAAI,KAAM,CAAW,CAAC,OAAO,EAAE,CAC5D,CAAC;IACJ,CAAC;IACD,IAAI,IAAa,CAAC;IAClB,IAAI,CAAC;QACH,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACzB,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,MAAM,IAAI,KAAK,CACb,6BAA6B,IAAI,KAAM,CAAW,CAAC,OAAO,EAAE,CAC7D,CAAC;IACJ,CAAC;IACD,mEAAmE;IACnE,+CAA+C;IAC/C,OAAO,eAAe,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;AACrC,CAAC"}
package/package.json ADDED
@@ -0,0 +1,56 @@
1
+ {
2
+ "name": "@cassida/vite-plugin",
3
+ "version": "0.1.0",
4
+ "description": "Vite plugin for Cassida: transforms cas() chains to static className + CSS at build time, served via virtual:cassida.css.",
5
+ "license": "MIT",
6
+ "type": "module",
7
+ "main": "./dist/index.js",
8
+ "types": "./dist/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "types": "./dist/index.d.ts",
12
+ "import": "./dist/index.js"
13
+ }
14
+ },
15
+ "files": [
16
+ "dist"
17
+ ],
18
+ "dependencies": {
19
+ "browserslist": "^4.24.2",
20
+ "lightningcss": "^1.28.1",
21
+ "@cassida/compiler": "0.1.0",
22
+ "@cassida/parser": "0.1.0"
23
+ },
24
+ "peerDependencies": {
25
+ "vite": "^5.0.0 || ^6.0.0 || ^7.0.0"
26
+ },
27
+ "devDependencies": {
28
+ "@types/node": "^22.9.0",
29
+ "typescript": "^5.6.3",
30
+ "vite": "^7.1.13"
31
+ },
32
+ "repository": {
33
+ "type": "git",
34
+ "url": "git+https://github.com/pishio/cassida.git",
35
+ "directory": "packages/vite-plugin"
36
+ },
37
+ "homepage": "https://github.com/pishio/cassida/tree/main/packages/vite-plugin#readme",
38
+ "bugs": {
39
+ "url": "https://github.com/pishio/cassida/issues"
40
+ },
41
+ "author": "pishio",
42
+ "keywords": [
43
+ "cassida",
44
+ "css-in-js",
45
+ "compile-time",
46
+ "single-class",
47
+ "react"
48
+ ],
49
+ "publishConfig": {
50
+ "access": "public"
51
+ },
52
+ "scripts": {
53
+ "build": "tsc -p tsconfig.json",
54
+ "typecheck": "tsc -p tsconfig.json --noEmit"
55
+ }
56
+ }