Skip to content

Commit 6b0faa8

Browse files
committed
chore: remove useless code
1 parent 4c32064 commit 6b0faa8

File tree

2 files changed

+0
-60
lines changed

2 files changed

+0
-60
lines changed

packages/unplugin-tailwindcss-mangle/src/types.ts

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,5 @@
11
import type { ClassGenerator } from 'tailwindcss-mangle-core'
22

3-
export interface IClassGeneratorContextItem {
4-
name: string
5-
usedBy: any[]
6-
}
7-
83
export interface IClassGeneratorOptions {
94
reserveClassName?: (string | RegExp)[]
105
customGenerate?: (original: string, opts: IClassGeneratorOptions, context: Record<string, any>) => string | undefined
@@ -15,12 +10,6 @@ export interface IClassGeneratorOptions {
1510
classPrefix?: string
1611
}
1712

18-
export interface IClassGenerator {
19-
newClassMap: Record<string, IClassGeneratorContextItem>
20-
newClassSize: number
21-
context: Record<string, any>
22-
}
23-
2413
export interface IHandlerOptions {
2514
runtimeSet: Set<string>
2615
classGenerator: ClassGenerator

packages/unplugin-tailwindcss-mangle/src/utils.ts

Lines changed: 0 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import type { IClassGeneratorOptions, IClassGenerator } from './types'
21
import micromatch from 'micromatch'
32
import fs from 'fs'
43
import path from 'path'
@@ -79,27 +78,6 @@ export function getGroupedEntries<T>(
7978
return groupedEntries as Record<'css' | 'html' | 'js' | 'other', [string, T][]>
8079
}
8180

82-
export const acceptChars = 'abcdefghijklmnopqrstuvwxyz'.split('')
83-
84-
export function stripEscapeSequence(words: string) {
85-
return words.replace(/\\/g, '')
86-
}
87-
88-
export const validate = (opts: IClassGeneratorOptions, classGenerator: IClassGenerator) => {
89-
if (!opts.log) return
90-
for (const className in classGenerator.newClassMap) {
91-
const c = classGenerator.newClassMap[className]
92-
if (c.usedBy.length >= 1) {
93-
continue
94-
}
95-
if (c.usedBy[0].match(/.+\.css:*$/)) {
96-
console.log(`The class name '${className}' is not used: defined at ${c.usedBy[0]}.`)
97-
} else {
98-
console.log(`The class name '${className}' is not defined: used at ${c.usedBy[0]}.`)
99-
}
100-
}
101-
}
102-
10381
export function isRegexp(value: unknown) {
10482
return Object.prototype.toString.call(value) === '[object RegExp]'
10583
}
@@ -108,33 +86,6 @@ export function isMap(value: unknown) {
10886
return Object.prototype.toString.call(value) === '[object Map]'
10987
}
11088

111-
export function regExpTest(arr: (string | RegExp)[] = [], str: string) {
112-
if (Array.isArray(arr)) {
113-
for (let i = 0; i < arr.length; i++) {
114-
const item = arr[i]
115-
if (typeof item === 'string') {
116-
if (item === str) {
117-
return true
118-
}
119-
} else if (isRegexp(item)) {
120-
item.lastIndex = 0
121-
if (item.test(str)) {
122-
return true
123-
}
124-
}
125-
}
126-
return false
127-
}
128-
throw new TypeError("paramater 'arr' should be a Array of Regexp | String !")
129-
}
130-
131-
export function escapeStringRegexp(str: string) {
132-
if (typeof str !== 'string') {
133-
throw new TypeError('Expected a string')
134-
}
135-
return str.replace(/[|\\{}()[\]^$+*?.]/g, '\\$&').replace(/-/g, '\\x2d')
136-
}
137-
13889
export function createGlobMatcher(pattern: string | string[] | undefined, fallbackValue: boolean = false) {
13990
if (typeof pattern === 'undefined') {
14091
return function (file: string) {

0 commit comments

Comments
 (0)