@cssxio/babel-plugin 0.4.2 → 0.4.4

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 CHANGED
@@ -29,4 +29,4 @@ export default {
29
29
 
30
30
  The plugin accepts an optional `theme` string containing CSS text with CSSX `@theme` input. Use `themeFile` in the CSSX adapter when the build tool should read theme CSS text from a file.
31
31
 
32
- Set `stableClassNames: true` when development builds need composite class names to remain stable across CSS-only edits. The generated names are derived from the source file and call site, so use the same setting consistently for a given development environment.
32
+ Set `stableClassNames: true` when development builds need composite class names to remain stable across CSS-only edits, or when a framework transforms server and client modules in separate compiler processes. The generated names are derived from the source file and call site, so use the same setting consistently for a given build.
package/dist/index.cjs CHANGED
@@ -151,7 +151,7 @@ function cssxBabelPlugin(api, options = {}) {
151
151
  visitor: {
152
152
  Program: {
153
153
  enter(_path, babelState) {
154
- fileName = babelState.file.opts.filename ?? "";
154
+ fileName = options.stableClassNameFileName ?? babelState.file.opts.filename ?? "";
155
155
  state = {
156
156
  classNameAllocator: options.classNameAllocator ?? (0, import_compiler.createClassNameAllocator)(options.className),
157
157
  styles: /* @__PURE__ */ new Map(),
package/dist/index.d.cts CHANGED
@@ -14,8 +14,10 @@ interface CssxPluginOptions {
14
14
  readonly classNameAllocator?: ClassNameAllocator;
15
15
  /** Controls how aggressively static styles share generated class fragments. */
16
16
  readonly reusabilityBudget?: ReusabilityBudget;
17
- /** Uses source-addressed composite names for development stylesheet updates. */
17
+ /** Uses source-addressed composite names across independently transformed modules. */
18
18
  readonly stableClassNames?: boolean;
19
+ /** Canonical source identifier used when deriving stable composite class names. */
20
+ readonly stableClassNameFileName?: string;
19
21
  /** Controls how the `dark` variant is activated. */
20
22
  readonly darkMode?: DarkMode;
21
23
  }
package/dist/index.d.ts CHANGED
@@ -14,8 +14,10 @@ interface CssxPluginOptions {
14
14
  readonly classNameAllocator?: ClassNameAllocator;
15
15
  /** Controls how aggressively static styles share generated class fragments. */
16
16
  readonly reusabilityBudget?: ReusabilityBudget;
17
- /** Uses source-addressed composite names for development stylesheet updates. */
17
+ /** Uses source-addressed composite names across independently transformed modules. */
18
18
  readonly stableClassNames?: boolean;
19
+ /** Canonical source identifier used when deriving stable composite class names. */
20
+ readonly stableClassNameFileName?: string;
19
21
  /** Controls how the `dark` variant is activated. */
20
22
  readonly darkMode?: DarkMode;
21
23
  }
package/dist/index.js CHANGED
@@ -125,7 +125,7 @@ function cssxBabelPlugin(api, options = {}) {
125
125
  visitor: {
126
126
  Program: {
127
127
  enter(_path, babelState) {
128
- fileName = babelState.file.opts.filename ?? "";
128
+ fileName = options.stableClassNameFileName ?? babelState.file.opts.filename ?? "";
129
129
  state = {
130
130
  classNameAllocator: options.classNameAllocator ?? createClassNameAllocator(options.className),
131
131
  styles: /* @__PURE__ */ new Map(),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cssxio/babel-plugin",
3
- "version": "0.4.2",
3
+ "version": "0.4.4",
4
4
  "description": "Babel compiler transform for CSSX.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -27,7 +27,7 @@
27
27
  "@babel/core": "^7.28.0"
28
28
  },
29
29
  "dependencies": {
30
- "@cssxio/compiler": "^0.4.2"
30
+ "@cssxio/compiler": "^0.5.0"
31
31
  },
32
32
  "scripts": {
33
33
  "build": "tsup src/index.ts --format esm,cjs --dts --external @babel/core --clean"