@tailwindcss-mangle/shared 1.2.7 → 2.0.4
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/index.cjs +1 -17
- package/dist/index.d.ts +2 -3
- package/dist/index.mjs +2 -17
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -42,21 +42,6 @@ const acceptChars = [..."abcdefghijklmnopqrstuvwxyz"];
|
|
|
42
42
|
function stripEscapeSequence(words) {
|
|
43
43
|
return words.replaceAll("\\", "");
|
|
44
44
|
}
|
|
45
|
-
const validate = (opts, classGenerator) => {
|
|
46
|
-
if (!opts.log)
|
|
47
|
-
return;
|
|
48
|
-
for (const className in classGenerator.newClassMap) {
|
|
49
|
-
const c = classGenerator.newClassMap[className];
|
|
50
|
-
if (c.usedBy.length > 0) {
|
|
51
|
-
continue;
|
|
52
|
-
}
|
|
53
|
-
if (/.+\.css:*$/.test(c.usedBy[0])) {
|
|
54
|
-
console.log(`The class name '${className}' is not used: defined at ${c.usedBy[0]}.`);
|
|
55
|
-
} else {
|
|
56
|
-
console.log(`The class name '${className}' is not defined: used at ${c.usedBy[0]}.`);
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
};
|
|
60
45
|
function isRegexp(value) {
|
|
61
46
|
return Object.prototype.toString.call(value) === "[object RegExp]";
|
|
62
47
|
}
|
|
@@ -156,7 +141,7 @@ class ClassGenerator {
|
|
|
156
141
|
}
|
|
157
142
|
const newClass = {
|
|
158
143
|
name: newClassName,
|
|
159
|
-
usedBy:
|
|
144
|
+
usedBy: /* @__PURE__ */ new Set()
|
|
160
145
|
};
|
|
161
146
|
this.newClassMap[original] = newClass;
|
|
162
147
|
this.newClassSize++;
|
|
@@ -198,5 +183,4 @@ exports.preserveClassNames = preserveClassNames;
|
|
|
198
183
|
exports.regExpTest = regExpTest;
|
|
199
184
|
exports.splitCode = splitCode;
|
|
200
185
|
exports.stripEscapeSequence = stripEscapeSequence;
|
|
201
|
-
exports.validate = validate;
|
|
202
186
|
exports.validateFilterRE = validateFilterRE;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
interface IClassGeneratorContextItem {
|
|
2
2
|
name: string;
|
|
3
|
-
usedBy:
|
|
3
|
+
usedBy: Set<string>;
|
|
4
4
|
}
|
|
5
5
|
interface IClassGeneratorOptions {
|
|
6
6
|
reserveClassName?: (string | RegExp)[];
|
|
@@ -49,9 +49,8 @@ declare const defaultMangleClassFilter: (className: string) => boolean;
|
|
|
49
49
|
declare function groupBy<T>(arr: T[], cb: (arg: T) => string): Record<string, T[]>;
|
|
50
50
|
declare const acceptChars: string[];
|
|
51
51
|
declare function stripEscapeSequence(words: string): string;
|
|
52
|
-
declare const validate: (opts: IClassGeneratorOptions, classGenerator: IClassGenerator) => void;
|
|
53
52
|
declare function isRegexp(value: unknown): boolean;
|
|
54
53
|
declare function isMap(value: unknown): boolean;
|
|
55
54
|
declare function regExpTest(arr: (string | RegExp)[] | undefined, str: string): boolean;
|
|
56
55
|
|
|
57
|
-
export { ClassGenerator, IClassGenerator, IClassGeneratorContextItem, IClassGeneratorOptions, acceptChars, defaultMangleClassFilter, escapeStringRegexp, groupBy, isMap, isRegexp, isValidSelector, makeRegex, preserveClassNames, regExpTest, splitCode, stripEscapeSequence,
|
|
56
|
+
export { ClassGenerator, IClassGenerator, IClassGeneratorContextItem, IClassGeneratorOptions, acceptChars, defaultMangleClassFilter, escapeStringRegexp, groupBy, isMap, isRegexp, isValidSelector, makeRegex, preserveClassNames, regExpTest, splitCode, stripEscapeSequence, validateFilterRE };
|
package/dist/index.mjs
CHANGED
|
@@ -40,21 +40,6 @@ const acceptChars = [..."abcdefghijklmnopqrstuvwxyz"];
|
|
|
40
40
|
function stripEscapeSequence(words) {
|
|
41
41
|
return words.replaceAll("\\", "");
|
|
42
42
|
}
|
|
43
|
-
const validate = (opts, classGenerator) => {
|
|
44
|
-
if (!opts.log)
|
|
45
|
-
return;
|
|
46
|
-
for (const className in classGenerator.newClassMap) {
|
|
47
|
-
const c = classGenerator.newClassMap[className];
|
|
48
|
-
if (c.usedBy.length > 0) {
|
|
49
|
-
continue;
|
|
50
|
-
}
|
|
51
|
-
if (/.+\.css:*$/.test(c.usedBy[0])) {
|
|
52
|
-
console.log(`The class name '${className}' is not used: defined at ${c.usedBy[0]}.`);
|
|
53
|
-
} else {
|
|
54
|
-
console.log(`The class name '${className}' is not defined: used at ${c.usedBy[0]}.`);
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
};
|
|
58
43
|
function isRegexp(value) {
|
|
59
44
|
return Object.prototype.toString.call(value) === "[object RegExp]";
|
|
60
45
|
}
|
|
@@ -154,7 +139,7 @@ class ClassGenerator {
|
|
|
154
139
|
}
|
|
155
140
|
const newClass = {
|
|
156
141
|
name: newClassName,
|
|
157
|
-
usedBy:
|
|
142
|
+
usedBy: /* @__PURE__ */ new Set()
|
|
158
143
|
};
|
|
159
144
|
this.newClassMap[original] = newClass;
|
|
160
145
|
this.newClassSize++;
|
|
@@ -183,4 +168,4 @@ const splitCode = (code, options = { splitQuote: true }) => {
|
|
|
183
168
|
return code.split(regex).filter((x) => isValidSelector(x));
|
|
184
169
|
};
|
|
185
170
|
|
|
186
|
-
export { ClassGenerator, acceptChars, defaultMangleClassFilter, escapeStringRegexp, groupBy, isMap, isRegexp, isValidSelector, makeRegex, preserveClassNames, regExpTest, splitCode, stripEscapeSequence,
|
|
171
|
+
export { ClassGenerator, acceptChars, defaultMangleClassFilter, escapeStringRegexp, groupBy, isMap, isRegexp, isValidSelector, makeRegex, preserveClassNames, regExpTest, splitCode, stripEscapeSequence, validateFilterRE };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tailwindcss-mangle/shared",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.4",
|
|
4
4
|
"description": "The shared utils of tailwindcss-mangle",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
},
|
|
47
47
|
"scripts": {
|
|
48
48
|
"build": "unbuild",
|
|
49
|
-
"test": "vitest run",
|
|
49
|
+
"test": "vitest run --coverage.enabled",
|
|
50
50
|
"test:dev": "vitest"
|
|
51
51
|
}
|
|
52
52
|
}
|