elcrm 1.1.11 → 1.1.12
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.
|
@@ -70,6 +70,8 @@ function namespaceSize(length) {
|
|
|
70
70
|
}
|
|
71
71
|
function allocateUnique(originals, reserved, make, start, capacity, kind) {
|
|
72
72
|
const taken = new Set(reserved);
|
|
73
|
+
for (const from of originals)
|
|
74
|
+
taken.add(from);
|
|
73
75
|
const out = new Map;
|
|
74
76
|
let cursor = start;
|
|
75
77
|
for (const from of originals) {
|
|
@@ -91,12 +93,13 @@ function allocateUnique(originals, reserved, make, start, capacity, kind) {
|
|
|
91
93
|
taken.add(found);
|
|
92
94
|
}
|
|
93
95
|
const used = new Set;
|
|
96
|
+
const originalSet = new Set(originals);
|
|
94
97
|
for (const [from, to] of out) {
|
|
95
98
|
if (used.has(to)) {
|
|
96
99
|
throw new Error(`[minify-css-vars] коллизия ${kind}: «${from}» и ещё одно имя → «${to}»`);
|
|
97
100
|
}
|
|
98
101
|
used.add(to);
|
|
99
|
-
if (reserved.has(to)) {
|
|
102
|
+
if (reserved.has(to) || originalSet.has(to)) {
|
|
100
103
|
throw new Error(`[minify-css-vars] «${from}» → «${to}» затирает существующее имя ${kind}`);
|
|
101
104
|
}
|
|
102
105
|
}
|
|
@@ -112,10 +115,15 @@ function collectCssVarNames(texts) {
|
|
|
112
115
|
return [...collect(texts, VAR_RE)].sort();
|
|
113
116
|
}
|
|
114
117
|
function applyVarDictionary(text, map) {
|
|
115
|
-
const entries = [...map].sort((a, b) => b[0].length - a[0].length);
|
|
118
|
+
const entries = [...map].sort((a, b) => b[0].length - a[0].length || a[0].localeCompare(b[0]));
|
|
119
|
+
const mark = (i) => `${i.toString(36)}`;
|
|
116
120
|
let out = text;
|
|
117
|
-
for (
|
|
118
|
-
out = replaceCssVarToken(out,
|
|
121
|
+
for (let i = 0;i < entries.length; i++) {
|
|
122
|
+
out = replaceCssVarToken(out, entries[i][0], mark(i));
|
|
123
|
+
}
|
|
124
|
+
for (let i = 0;i < entries.length; i++) {
|
|
125
|
+
out = out.split(mark(i)).join(entries[i][1]);
|
|
126
|
+
}
|
|
119
127
|
return out;
|
|
120
128
|
}
|
|
121
129
|
function isVendorJsChunk(code) {
|
package/package.json
CHANGED
|
@@ -92,7 +92,7 @@ elcrm test --front|--server|--no-scripts
|
|
|
92
92
|
|
|
93
93
|
### Vite-плагины из пакета `elcrm`
|
|
94
94
|
|
|
95
|
-
Нужен **elcrm ≥ 1.1.
|
|
95
|
+
Нужен **elcrm ≥ 1.1.12** в `devDependencies` приложения (не только глобальный `bun i -g`). Иначе Vite: `Missing "./vite/minify-css-vars"` или CSS-in-JS / цепочка замен схлопывает токены.
|
|
96
96
|
|
|
97
97
|
```js
|
|
98
98
|
import { minifyCssVars } from "elcrm/vite/minify-css-vars";
|