@kbach/react 0.5.30 → 0.5.32
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/dist/vite-plugin.d.mts +1 -2
- package/dist/vite-plugin.d.ts +1 -2
- package/dist/vite-plugin.js +3 -17
- package/dist/vite-plugin.mjs +3 -16
- package/package.json +1 -1
package/dist/vite-plugin.d.mts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { Plugin } from 'vite';
|
|
2
2
|
import { F as FrameworkConfig } from './types-CV5vXnSH.mjs';
|
|
3
3
|
|
|
4
|
-
declare const VIRTUAL_ID = "virtual:kbach/styles.css";
|
|
5
4
|
declare function kbach(userConfig?: FrameworkConfig): Plugin;
|
|
6
5
|
|
|
7
|
-
export {
|
|
6
|
+
export { kbach };
|
package/dist/vite-plugin.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { Plugin } from 'vite';
|
|
2
2
|
import { F as FrameworkConfig } from './types-CV5vXnSH.js';
|
|
3
3
|
|
|
4
|
-
declare const VIRTUAL_ID = "virtual:kbach/styles.css";
|
|
5
4
|
declare function kbach(userConfig?: FrameworkConfig): Plugin;
|
|
6
5
|
|
|
7
|
-
export {
|
|
6
|
+
export { kbach };
|
package/dist/vite-plugin.js
CHANGED
|
@@ -20,7 +20,6 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
20
20
|
// src/vite-plugin.ts
|
|
21
21
|
var vite_plugin_exports = {};
|
|
22
22
|
__export(vite_plugin_exports, {
|
|
23
|
-
VIRTUAL_ID: () => VIRTUAL_ID,
|
|
24
23
|
kbach: () => kbach
|
|
25
24
|
});
|
|
26
25
|
module.exports = __toCommonJS(vite_plugin_exports);
|
|
@@ -3348,8 +3347,6 @@ var customVariants = new Proxy(
|
|
|
3348
3347
|
);
|
|
3349
3348
|
|
|
3350
3349
|
// src/vite-plugin.ts
|
|
3351
|
-
var VIRTUAL_ID = "virtual:kbach/styles.css";
|
|
3352
|
-
var RESOLVED_ID = "\0virtual:kbach/styles.css";
|
|
3353
3350
|
var KBACH_START = "/* kbach:start */";
|
|
3354
3351
|
var KBACH_END = "/* kbach:end */";
|
|
3355
3352
|
var GROUPS = [
|
|
@@ -3462,6 +3459,7 @@ function toNumericScreens(screens) {
|
|
|
3462
3459
|
}
|
|
3463
3460
|
return out;
|
|
3464
3461
|
}
|
|
3462
|
+
var normPath = (p) => p.split("\\").join("/");
|
|
3465
3463
|
function scanDir(dir, onFile) {
|
|
3466
3464
|
try {
|
|
3467
3465
|
for (const entry of (0, import_fs.readdirSync)(dir)) {
|
|
@@ -3470,7 +3468,7 @@ function scanDir(dir, onFile) {
|
|
|
3470
3468
|
try {
|
|
3471
3469
|
const st = (0, import_fs.statSync)(full);
|
|
3472
3470
|
if (st.isDirectory()) scanDir(full, onFile);
|
|
3473
|
-
else if (/\.(tsx?|jsx?)$/.test(entry)) onFile((0, import_fs.readFileSync)(full, "utf-8"), full);
|
|
3471
|
+
else if (/\.(tsx?|jsx?)$/.test(entry)) onFile((0, import_fs.readFileSync)(full, "utf-8"), normPath(full));
|
|
3474
3472
|
} catch {
|
|
3475
3473
|
}
|
|
3476
3474
|
}
|
|
@@ -3536,21 +3534,10 @@ function kbach(userConfig) {
|
|
|
3536
3534
|
mainCSSFile = findMainCSSFile(root);
|
|
3537
3535
|
if (mainCSSFile) writeKbachToFile(mainCSSFile, getFormattedCSS());
|
|
3538
3536
|
},
|
|
3539
|
-
transform(code, id) {
|
|
3540
|
-
const filePath = id.split("?")[0];
|
|
3541
|
-
if (/\.(tsx?|jsx?)$/.test(filePath) && !id.includes("node_modules"))
|
|
3542
|
-
fileTokens.set(filePath, extractTokensFromCode(code));
|
|
3543
|
-
},
|
|
3544
|
-
resolveId(id) {
|
|
3545
|
-
if (id === VIRTUAL_ID) return RESOLVED_ID;
|
|
3546
|
-
},
|
|
3547
|
-
load(id) {
|
|
3548
|
-
if (id === RESOLVED_ID) return getFormattedCSS();
|
|
3549
|
-
},
|
|
3550
3537
|
handleHotUpdate({ file }) {
|
|
3551
3538
|
if (file.includes("node_modules") || !/\.(tsx?|jsx?)$/.test(file)) return;
|
|
3552
3539
|
try {
|
|
3553
|
-
fileTokens.set(file, extractTokensFromCode((0, import_fs.readFileSync)(file, "utf-8")));
|
|
3540
|
+
fileTokens.set(normPath(file), extractTokensFromCode((0, import_fs.readFileSync)(file, "utf-8")));
|
|
3554
3541
|
if (rebuildTokenCSS() && mainCSSFile) writeKbachToFile(mainCSSFile, getFormattedCSS());
|
|
3555
3542
|
} catch {
|
|
3556
3543
|
}
|
|
@@ -3559,6 +3546,5 @@ function kbach(userConfig) {
|
|
|
3559
3546
|
}
|
|
3560
3547
|
// Annotate the CommonJS export names for ESM import in node:
|
|
3561
3548
|
0 && (module.exports = {
|
|
3562
|
-
VIRTUAL_ID,
|
|
3563
3549
|
kbach
|
|
3564
3550
|
});
|
package/dist/vite-plugin.mjs
CHANGED
|
@@ -6,8 +6,6 @@ import {
|
|
|
6
6
|
// src/vite-plugin.ts
|
|
7
7
|
import { readFileSync, writeFileSync, existsSync, readdirSync, statSync } from "fs";
|
|
8
8
|
import { join } from "path";
|
|
9
|
-
var VIRTUAL_ID = "virtual:kbach/styles.css";
|
|
10
|
-
var RESOLVED_ID = "\0virtual:kbach/styles.css";
|
|
11
9
|
var KBACH_START = "/* kbach:start */";
|
|
12
10
|
var KBACH_END = "/* kbach:end */";
|
|
13
11
|
var GROUPS = [
|
|
@@ -120,6 +118,7 @@ function toNumericScreens(screens) {
|
|
|
120
118
|
}
|
|
121
119
|
return out;
|
|
122
120
|
}
|
|
121
|
+
var normPath = (p) => p.split("\\").join("/");
|
|
123
122
|
function scanDir(dir, onFile) {
|
|
124
123
|
try {
|
|
125
124
|
for (const entry of readdirSync(dir)) {
|
|
@@ -128,7 +127,7 @@ function scanDir(dir, onFile) {
|
|
|
128
127
|
try {
|
|
129
128
|
const st = statSync(full);
|
|
130
129
|
if (st.isDirectory()) scanDir(full, onFile);
|
|
131
|
-
else if (/\.(tsx?|jsx?)$/.test(entry)) onFile(readFileSync(full, "utf-8"), full);
|
|
130
|
+
else if (/\.(tsx?|jsx?)$/.test(entry)) onFile(readFileSync(full, "utf-8"), normPath(full));
|
|
132
131
|
} catch {
|
|
133
132
|
}
|
|
134
133
|
}
|
|
@@ -194,21 +193,10 @@ function kbach(userConfig) {
|
|
|
194
193
|
mainCSSFile = findMainCSSFile(root);
|
|
195
194
|
if (mainCSSFile) writeKbachToFile(mainCSSFile, getFormattedCSS());
|
|
196
195
|
},
|
|
197
|
-
transform(code, id) {
|
|
198
|
-
const filePath = id.split("?")[0];
|
|
199
|
-
if (/\.(tsx?|jsx?)$/.test(filePath) && !id.includes("node_modules"))
|
|
200
|
-
fileTokens.set(filePath, extractTokensFromCode(code));
|
|
201
|
-
},
|
|
202
|
-
resolveId(id) {
|
|
203
|
-
if (id === VIRTUAL_ID) return RESOLVED_ID;
|
|
204
|
-
},
|
|
205
|
-
load(id) {
|
|
206
|
-
if (id === RESOLVED_ID) return getFormattedCSS();
|
|
207
|
-
},
|
|
208
196
|
handleHotUpdate({ file }) {
|
|
209
197
|
if (file.includes("node_modules") || !/\.(tsx?|jsx?)$/.test(file)) return;
|
|
210
198
|
try {
|
|
211
|
-
fileTokens.set(file, extractTokensFromCode(readFileSync(file, "utf-8")));
|
|
199
|
+
fileTokens.set(normPath(file), extractTokensFromCode(readFileSync(file, "utf-8")));
|
|
212
200
|
if (rebuildTokenCSS() && mainCSSFile) writeKbachToFile(mainCSSFile, getFormattedCSS());
|
|
213
201
|
} catch {
|
|
214
202
|
}
|
|
@@ -216,6 +204,5 @@ function kbach(userConfig) {
|
|
|
216
204
|
};
|
|
217
205
|
}
|
|
218
206
|
export {
|
|
219
|
-
VIRTUAL_ID,
|
|
220
207
|
kbach
|
|
221
208
|
};
|