@mlut/core 2.1.0 → 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.
@@ -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 = new URL('.', import.meta.url).pathname;
9
+ const __dirname = path.dirname(fileURLToPath(import.meta.url));
9
10
  export class JitEngine {
10
11
  utils = new Set();
11
12
  inputFileDir = __dirname;
@@ -22,6 +23,7 @@ export class JitEngine {
22
23
  utilName: /^-?[A-Z]{1}[a-zA-Z]*/,
23
24
  uppercaseLetter: /[A-Z]/,
24
25
  contextUtil: /-Ctx([\d\-#]|$)/,
26
+ valueSeparator: /[0-9-#=]/,
25
27
  };
26
28
  configRegexps = {
27
29
  userSettings: /@use ['"][^'"]*(tools|mlut|core)['"](\s*as\s+[\w]+)?\s+with\s*\(([^;]+)\);/s,
@@ -84,6 +86,10 @@ export class JitEngine {
84
86
  return [...allClassNames.join(' ').split(' ').reduce((acc, cssClass) => {
85
87
  const utility = cssClass.split('_').find((str) => (this.utilsRegexps.utilName.test(str)));
86
88
  if (utility) {
89
+ const separator = utility.replace(this.utilsRegexps.utilName, '')[0];
90
+ if (separator && !this.utilsRegexps.valueSeparator.test(separator)) {
91
+ return acc;
92
+ }
87
93
  const utilName = utility.match(this.utilsRegexps.utilName)?.[0];
88
94
  if (this.utils.has(utilName) ||
89
95
  (utilName[0] === '-' && !this.utilsRegexps.contextUtil.test(utilName))) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mlut/core",
3
- "version": "2.1.0",
3
+ "version": "2.1.1",
4
4
  "description": "Atomic CSS toolkit with Sass and ergonomics for creating styles of any complexity",
5
5
  "author": "mr150",
6
6
  "type": "module",