@mlut/core 2.0.1 → 2.1.1
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/jit/JitEngine.js
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import path from 'node:path';
|
|
2
|
+
import { fileURLToPath } from 'node:url';
|
|
2
3
|
import { logger } from '../utils/index.js';
|
|
3
4
|
const sass = await import('sass-embedded')
|
|
4
5
|
.catch(() => import('sass'))
|
|
5
6
|
.catch(() => {
|
|
6
7
|
throw new Error('The Sass package is not installed. You can do this with `npm i -D sass-embedded`');
|
|
7
8
|
});
|
|
8
|
-
const __dirname =
|
|
9
|
+
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
9
10
|
export class JitEngine {
|
|
10
11
|
utils = new Set();
|
|
11
12
|
inputFileDir = __dirname;
|
|
@@ -21,6 +22,8 @@ export class JitEngine {
|
|
|
21
22
|
escapedQuotes: /\\['"`]/g,
|
|
22
23
|
utilName: /^-?[A-Z]{1}[a-zA-Z]*/,
|
|
23
24
|
uppercaseLetter: /[A-Z]/,
|
|
25
|
+
contextUtil: /-Ctx([\d\-#]|$)/,
|
|
26
|
+
valueSeparator: /[0-9-#=]/,
|
|
24
27
|
};
|
|
25
28
|
configRegexps = {
|
|
26
29
|
userSettings: /@use ['"][^'"]*(tools|mlut|core)['"](\s*as\s+[\w]+)?\s+with\s*\(([^;]+)\);/s,
|
|
@@ -83,8 +86,13 @@ export class JitEngine {
|
|
|
83
86
|
return [...allClassNames.join(' ').split(' ').reduce((acc, cssClass) => {
|
|
84
87
|
const utility = cssClass.split('_').find((str) => (this.utilsRegexps.utilName.test(str)));
|
|
85
88
|
if (utility) {
|
|
89
|
+
const separator = utility.replace(this.utilsRegexps.utilName, '')[0];
|
|
90
|
+
if (separator && !this.utilsRegexps.valueSeparator.test(separator)) {
|
|
91
|
+
return acc;
|
|
92
|
+
}
|
|
86
93
|
const utilName = utility.match(this.utilsRegexps.utilName)?.[0];
|
|
87
|
-
if (this.utils.has(utilName) ||
|
|
94
|
+
if (this.utils.has(utilName) ||
|
|
95
|
+
(utilName[0] === '-' && !this.utilsRegexps.contextUtil.test(utilName))) {
|
|
88
96
|
acc.add(cssClass);
|
|
89
97
|
}
|
|
90
98
|
}
|
|
@@ -1591,6 +1591,18 @@ $utils-db: (
|
|
|
1591
1591
|
'nn': none,
|
|
1592
1592
|
),
|
|
1593
1593
|
),
|
|
1594
|
+
'Coi': (
|
|
1595
|
+
'properties': counter-increment,
|
|
1596
|
+
'conversion': 'num-length',
|
|
1597
|
+
),
|
|
1598
|
+
'Cor': (
|
|
1599
|
+
'properties': counter-reset,
|
|
1600
|
+
'conversion': 'num-length',
|
|
1601
|
+
),
|
|
1602
|
+
'Cos': (
|
|
1603
|
+
'properties': counter-set,
|
|
1604
|
+
'conversion': 'num-length',
|
|
1605
|
+
),
|
|
1594
1606
|
|
|
1595
1607
|
// SVG
|
|
1596
1608
|
'Fi': (
|