@csszyx/unplugin 0.8.0 → 0.9.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/README.md +16 -7
- package/dist/css-mangler.cjs +4 -4
- package/dist/css-mangler.mjs +4 -4
- package/dist/index.cjs +6 -1
- package/dist/index.d.cts +10 -1
- package/dist/index.d.mts +10 -1
- package/dist/index.mjs +5 -1
- package/dist/shared/{unplugin.DCv0RtVZ.mjs → unplugin.BEOG6ePC.mjs} +486 -49
- package/dist/shared/{unplugin.BNsv2szs.cjs → unplugin.CL0F6RZa.cjs} +486 -47
- package/dist/vite.cjs +5 -1
- package/dist/vite.mjs +5 -1
- package/dist/webpack.cjs +5 -1
- package/dist/webpack.mjs +5 -1
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -66,7 +66,7 @@ module.exports = {
|
|
|
66
66
|
|
|
67
67
|
## Features
|
|
68
68
|
|
|
69
|
-
- **sz prop transform** -- Compiles `sz={{ }}` objects into `className` strings. Defaults to **
|
|
69
|
+
- **sz prop transform** -- Compiles `sz={{ }}` objects into `className` strings. Defaults to the **native Rust engine** through the optional `@csszyx/core-*` platform package; opt back into the previous oxc-parser JavaScript path with `build.parser: "oxc"`, or fall through to Babel with `build.parser: "babel"`.
|
|
70
70
|
- **HTML injection** -- Injects mangle maps and checksums for SSR hydration
|
|
71
71
|
- **HMR support** -- Updates styles instantly during development
|
|
72
72
|
- **CSS mangling** -- Compresses class names (e.g., `text-center` -> `z`) in production builds
|
|
@@ -74,24 +74,33 @@ module.exports = {
|
|
|
74
74
|
|
|
75
75
|
## Parser selection
|
|
76
76
|
|
|
77
|
+
The default parser is `rust`, which runs through the native engine in the
|
|
78
|
+
matching optional `@csszyx/core-*` platform package. When that package is
|
|
79
|
+
missing, csszyx fails loudly instead of silently falling back to another
|
|
80
|
+
parser; reinstall to pick up the optional dependency for your platform, or
|
|
81
|
+
opt into the JavaScript engine explicitly.
|
|
82
|
+
|
|
77
83
|
Per project:
|
|
78
84
|
|
|
79
85
|
```ts
|
|
80
86
|
csszyx({
|
|
81
|
-
build: { parser: "
|
|
87
|
+
build: { parser: "oxc" }, // JavaScript oxc parser, no native addon
|
|
82
88
|
});
|
|
83
89
|
```
|
|
84
90
|
|
|
85
91
|
Per build:
|
|
86
92
|
|
|
87
93
|
```bash
|
|
88
|
-
CSSZYX_PARSER=
|
|
94
|
+
CSSZYX_PARSER=oxc pnpm build
|
|
89
95
|
```
|
|
90
96
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
the
|
|
94
|
-
|
|
97
|
+
The default `rust` path uses the native engine and shares the same
|
|
98
|
+
`className` output shape as the JavaScript parsers. `build.parser: "oxc"`
|
|
99
|
+
uses the previous JavaScript oxc-parser path with surgical magic-string
|
|
100
|
+
edits to preserve source formatting outside touched ranges.
|
|
101
|
+
`build.parser: "babel"` routes prescan, transform, and HMR discovery
|
|
102
|
+
through the legacy Babel implementation as a final compatibility escape
|
|
103
|
+
hatch.
|
|
95
104
|
|
|
96
105
|
## License
|
|
97
106
|
|
package/dist/css-mangler.cjs
CHANGED
|
@@ -18,9 +18,9 @@ function unescapeTailwindClass(escapedName) {
|
|
|
18
18
|
break;
|
|
19
19
|
}
|
|
20
20
|
const char = escapedName[i];
|
|
21
|
-
if (/[0-9a-
|
|
21
|
+
if (/[0-9a-f]/i.test(char)) {
|
|
22
22
|
let hexStr = "";
|
|
23
|
-
while (i < escapedName.length && /[0-9a-
|
|
23
|
+
while (i < escapedName.length && /[0-9a-f]/i.test(escapedName[i]) && hexStr.length < 6) {
|
|
24
24
|
hexStr += escapedName[i];
|
|
25
25
|
i++;
|
|
26
26
|
}
|
|
@@ -48,13 +48,13 @@ function escapeCSSClassName(className) {
|
|
|
48
48
|
const char = className[i];
|
|
49
49
|
const code = char.charCodeAt(0);
|
|
50
50
|
if (i === 0) {
|
|
51
|
-
if (
|
|
51
|
+
if (/\d/.test(char)) {
|
|
52
52
|
result += `\\3${char} `;
|
|
53
53
|
continue;
|
|
54
54
|
}
|
|
55
55
|
if (char === "-" && i + 1 < className.length) {
|
|
56
56
|
const next = className[i + 1];
|
|
57
|
-
if (
|
|
57
|
+
if (/\d/.test(next) || next === "-") {
|
|
58
58
|
result += "\\-";
|
|
59
59
|
continue;
|
|
60
60
|
}
|
package/dist/css-mangler.mjs
CHANGED
|
@@ -11,9 +11,9 @@ function unescapeTailwindClass(escapedName) {
|
|
|
11
11
|
break;
|
|
12
12
|
}
|
|
13
13
|
const char = escapedName[i];
|
|
14
|
-
if (/[0-9a-
|
|
14
|
+
if (/[0-9a-f]/i.test(char)) {
|
|
15
15
|
let hexStr = "";
|
|
16
|
-
while (i < escapedName.length && /[0-9a-
|
|
16
|
+
while (i < escapedName.length && /[0-9a-f]/i.test(escapedName[i]) && hexStr.length < 6) {
|
|
17
17
|
hexStr += escapedName[i];
|
|
18
18
|
i++;
|
|
19
19
|
}
|
|
@@ -41,13 +41,13 @@ function escapeCSSClassName(className) {
|
|
|
41
41
|
const char = className[i];
|
|
42
42
|
const code = char.charCodeAt(0);
|
|
43
43
|
if (i === 0) {
|
|
44
|
-
if (
|
|
44
|
+
if (/\d/.test(char)) {
|
|
45
45
|
result += `\\3${char} `;
|
|
46
46
|
continue;
|
|
47
47
|
}
|
|
48
48
|
if (char === "-" && i + 1 < className.length) {
|
|
49
49
|
const next = className[i + 1];
|
|
50
|
-
if (
|
|
50
|
+
if (/\d/.test(next) || next === "-") {
|
|
51
51
|
result += "\\-";
|
|
52
52
|
continue;
|
|
53
53
|
}
|
package/dist/index.cjs
CHANGED
|
@@ -3,14 +3,18 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
const cssMangler = require('./css-mangler.cjs');
|
|
6
|
-
const unplugin = require('./shared/unplugin.
|
|
6
|
+
const unplugin = require('./shared/unplugin.CL0F6RZa.cjs');
|
|
7
7
|
require('postcss');
|
|
8
8
|
require('postcss-selector-parser');
|
|
9
9
|
require('node:fs');
|
|
10
|
+
require('node:module');
|
|
10
11
|
require('node:path');
|
|
12
|
+
require('node:perf_hooks');
|
|
13
|
+
require('node:url');
|
|
11
14
|
require('@csszyx/compiler');
|
|
12
15
|
require('@csszyx/core');
|
|
13
16
|
require('@csszyx/svelte-adapter');
|
|
17
|
+
require('@csszyx/types');
|
|
14
18
|
require('@csszyx/vue-adapter');
|
|
15
19
|
require('unplugin');
|
|
16
20
|
require('node:crypto');
|
|
@@ -26,6 +30,7 @@ exports.assertNoRSCBoundaryViolation = unplugin.assertNoRSCBoundaryViolation;
|
|
|
26
30
|
exports.assertNoRSCGraphViolation = unplugin.assertNoRSCGraphViolation;
|
|
27
31
|
exports.createRSCModuleRecord = unplugin.createRSCModuleRecord;
|
|
28
32
|
exports.default = unplugin.unplugin;
|
|
33
|
+
exports.deleteRSCModuleRecord = unplugin.deleteRSCModuleRecord;
|
|
29
34
|
exports.esbuildPlugin = unplugin.esbuildPlugin;
|
|
30
35
|
exports.findRSCBoundaryViolation = unplugin.findRSCBoundaryViolation;
|
|
31
36
|
exports.findRSCGraphViolation = unplugin.findRSCGraphViolation;
|
package/dist/index.d.cts
CHANGED
|
@@ -81,6 +81,15 @@ declare function findRSCBoundaryViolation(code: string, id: string): RSCBoundary
|
|
|
81
81
|
* @returns graph metadata for the module
|
|
82
82
|
*/
|
|
83
83
|
declare function createRSCModuleRecord(code: string, id: string): RSCModuleRecord;
|
|
84
|
+
/**
|
|
85
|
+
* Removes a module record after the bundler watcher reports that the file was
|
|
86
|
+
* deleted.
|
|
87
|
+
*
|
|
88
|
+
* @param records module graph records keyed by normalized module ID
|
|
89
|
+
* @param id module ID/path from the watcher event
|
|
90
|
+
* @returns true when a stale record was removed
|
|
91
|
+
*/
|
|
92
|
+
declare function deleteRSCModuleRecord(records: Map<string, RSCModuleRecord>, id: string): boolean;
|
|
84
93
|
/**
|
|
85
94
|
* Finds forbidden runtime helper imports reachable from an RSC server module.
|
|
86
95
|
* Traversal stops at `'use client'` modules because they define a separate
|
|
@@ -153,5 +162,5 @@ declare function mergeThemes(themes: ParsedTheme[]): ParsedTheme;
|
|
|
153
162
|
*/
|
|
154
163
|
declare function hasTokens(theme: ParsedTheme): boolean;
|
|
155
164
|
|
|
156
|
-
export { assertNoRSCBoundaryViolation, assertNoRSCGraphViolation, createRSCModuleRecord, findRSCBoundaryViolation, findRSCGraphViolation, hasTokens, hasUseClientDirective, hasUseServerDirective, isRSCServerModule, mergeThemes, parseThemeBlocks };
|
|
165
|
+
export { assertNoRSCBoundaryViolation, assertNoRSCGraphViolation, createRSCModuleRecord, deleteRSCModuleRecord, findRSCBoundaryViolation, findRSCGraphViolation, hasTokens, hasUseClientDirective, hasUseServerDirective, isRSCServerModule, mergeThemes, parseThemeBlocks };
|
|
157
166
|
export type { ParsedTheme, RSCBoundaryViolation, RSCModuleRecord };
|
package/dist/index.d.mts
CHANGED
|
@@ -78,6 +78,15 @@ declare function findRSCBoundaryViolation(code: string, id: string): RSCBoundary
|
|
|
78
78
|
* @returns graph metadata for the module
|
|
79
79
|
*/
|
|
80
80
|
declare function createRSCModuleRecord(code: string, id: string): RSCModuleRecord;
|
|
81
|
+
/**
|
|
82
|
+
* Removes a module record after the bundler watcher reports that the file was
|
|
83
|
+
* deleted.
|
|
84
|
+
*
|
|
85
|
+
* @param records module graph records keyed by normalized module ID
|
|
86
|
+
* @param id module ID/path from the watcher event
|
|
87
|
+
* @returns true when a stale record was removed
|
|
88
|
+
*/
|
|
89
|
+
declare function deleteRSCModuleRecord(records: Map<string, RSCModuleRecord>, id: string): boolean;
|
|
81
90
|
/**
|
|
82
91
|
* Finds forbidden runtime helper imports reachable from an RSC server module.
|
|
83
92
|
* Traversal stops at `'use client'` modules because they define a separate
|
|
@@ -150,5 +159,5 @@ declare function mergeThemes(themes: ParsedTheme[]): ParsedTheme;
|
|
|
150
159
|
*/
|
|
151
160
|
declare function hasTokens(theme: ParsedTheme): boolean;
|
|
152
161
|
|
|
153
|
-
export { assertNoRSCBoundaryViolation, assertNoRSCGraphViolation, createRSCModuleRecord, findRSCBoundaryViolation, findRSCGraphViolation, hasTokens, hasUseClientDirective, hasUseServerDirective, isRSCServerModule, mergeThemes, parseThemeBlocks };
|
|
162
|
+
export { assertNoRSCBoundaryViolation, assertNoRSCGraphViolation, createRSCModuleRecord, deleteRSCModuleRecord, findRSCBoundaryViolation, findRSCGraphViolation, hasTokens, hasUseClientDirective, hasUseServerDirective, isRSCServerModule, mergeThemes, parseThemeBlocks };
|
|
154
163
|
export type { ParsedTheme, RSCBoundaryViolation, RSCModuleRecord };
|
package/dist/index.mjs
CHANGED
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
export { createPostCSSPlugin, escapeCSSClassName, mangleCSS, mangleCSSSync, unescapeTailwindClass } from './css-mangler.mjs';
|
|
2
|
-
export { a as assertNoRSCBoundaryViolation, b as assertNoRSCGraphViolation, c as createRSCModuleRecord, u as default, e as esbuildPlugin, f as findRSCBoundaryViolation,
|
|
2
|
+
export { a as assertNoRSCBoundaryViolation, b as assertNoRSCGraphViolation, c as createRSCModuleRecord, u as default, d as deleteRSCModuleRecord, e as esbuildPlugin, f as findRSCBoundaryViolation, g as findRSCGraphViolation, h as hasTokens, i as hasUseClientDirective, j as hasUseServerDirective, k as isRSCServerModule, m as mangleCodeClassesSync, l as mergeThemes, p as parseThemeBlocks, r as rollupPlugin, u as unplugin, v as vitePlugin, w as webpackPlugin } from './shared/unplugin.BEOG6ePC.mjs';
|
|
3
3
|
import 'postcss';
|
|
4
4
|
import 'postcss-selector-parser';
|
|
5
5
|
import 'node:fs';
|
|
6
|
+
import 'node:module';
|
|
6
7
|
import 'node:path';
|
|
8
|
+
import 'node:perf_hooks';
|
|
9
|
+
import 'node:url';
|
|
7
10
|
import '@csszyx/compiler';
|
|
8
11
|
import '@csszyx/core';
|
|
9
12
|
import '@csszyx/svelte-adapter';
|
|
13
|
+
import '@csszyx/types';
|
|
10
14
|
import '@csszyx/vue-adapter';
|
|
11
15
|
import 'unplugin';
|
|
12
16
|
import 'node:crypto';
|