New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

unplugin-tailwindcss-mangle

Package Overview
Dependencies
Maintainers
1
Versions
35
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

unplugin-tailwindcss-mangle - npm Package Compare versions

Comparing version 0.1.4 to 1.2.1

1

dist/esbuild.js

@@ -8,2 +8,3 @@ 'use strict';

require('path');
require('tailwindcss-mangle-shared');
require('tailwindcss-mangle-core');

@@ -10,0 +11,0 @@ require('tailwindcss-patch');

30

dist/index.js

@@ -9,2 +9,3 @@ 'use strict';

var path = require('path');
var tailwindcssMangleShared = require('tailwindcss-mangle-shared');
var tailwindcssMangleCore = require('tailwindcss-mangle-core');

@@ -22,26 +23,2 @@ var tailwindcssPatch = require('tailwindcss-patch');

const { isMatch } = micromatch__default["default"];
const isMangleClass = (className) => {
return /[-:]/.test(className);
};
function groupBy(arr, cb) {
if (!Array.isArray(arr)) {
throw new Error('expected an array for first argument');
}
if (typeof cb !== 'function') {
throw new Error('expected a function for second argument');
}
const result = {};
for (let i = 0; i < arr.length; i++) {
const item = arr[i];
const bucketCategory = cb(item);
const bucket = result[bucketCategory];
if (!Array.isArray(bucket)) {
result[bucketCategory] = [item];
}
else {
result[bucketCategory].push(item);
}
}
return result;
}
function getGroupedEntries(entries, options = {

@@ -59,3 +36,3 @@ cssMatcher(file) {

const { cssMatcher, htmlMatcher, jsMatcher } = options;
const groupedEntries = groupBy(entries, ([file]) => {
const groupedEntries = tailwindcssMangleShared.groupBy(entries, ([file]) => {
if (cssMatcher(file)) {

@@ -124,2 +101,3 @@ return 'css';

const excludeMatcher = createGlobMatcher(options.exclude, false);
const currentMangleClassFilter = options.mangleClassFilter ?? tailwindcssMangleShared.defaultMangleClassFilter;
function isInclude(file) {

@@ -151,3 +129,3 @@ return includeMatcher(file) && !excludeMatcher(file);

set.forEach((c) => {
if (!isMangleClass(c)) {
if (!currentMangleClassFilter(c)) {
set.delete(c);

@@ -154,0 +132,0 @@ }

@@ -8,2 +8,3 @@ 'use strict';

require('path');
require('tailwindcss-mangle-shared');
require('tailwindcss-mangle-core');

@@ -10,0 +11,0 @@ require('tailwindcss-patch');

@@ -8,2 +8,3 @@ 'use strict';

require('path');
require('tailwindcss-mangle-shared');
require('tailwindcss-mangle-core');

@@ -10,0 +11,0 @@ require('tailwindcss-patch');

import type { ClassGenerator } from 'tailwindcss-mangle-core';
export interface IClassGeneratorContextItem {
name: string;
usedBy: any[];
}
export interface IClassGeneratorOptions {

@@ -15,7 +11,2 @@ reserveClassName?: (string | RegExp)[];

}
export interface IClassGenerator {
newClassMap: Record<string, IClassGeneratorContextItem>;
newClassSize: number;
context: Record<string, any>;
}
export interface IHandlerOptions {

@@ -38,2 +29,3 @@ runtimeSet: Set<string>;

export interface Options {
mangleClassFilter?: (className: string) => boolean;
classGenerator?: IClassGeneratorOptions;

@@ -40,0 +32,0 @@ exclude?: string[];

@@ -1,4 +0,3 @@

import type { IClassGeneratorOptions, IClassGenerator } from './types';
export declare const isMangleClass: (className: string) => boolean;
export declare function groupBy<T>(arr: T[], cb: (arg: T) => string): Record<string, T[]>;
import { defaultMangleClassFilter, isMap, isRegexp } from 'tailwindcss-mangle-shared';
export { defaultMangleClassFilter, isMap, isRegexp };
export declare function getGroupedEntries<T>(entries: [string, T][], options?: {

@@ -9,9 +8,2 @@ cssMatcher(file: string): boolean;

}): Record<"css" | "html" | "js" | "other", [string, T][]>;
export declare const acceptChars: string[];
export declare function stripEscapeSequence(words: string): string;
export declare const validate: (opts: IClassGeneratorOptions, classGenerator: IClassGenerator) => void;
export declare function isRegexp(value: unknown): boolean;
export declare function isMap(value: unknown): boolean;
export declare function regExpTest(arr: (string | RegExp)[] | undefined, str: string): boolean;
export declare function escapeStringRegexp(str: string): string;
export declare function createGlobMatcher(pattern: string | string[] | undefined, fallbackValue?: boolean): (file: string) => boolean;

@@ -18,0 +10,0 @@ export declare function getCacheDir(basedir?: string): string;

@@ -8,2 +8,3 @@ 'use strict';

require('path');
require('tailwindcss-mangle-shared');
require('tailwindcss-mangle-core');

@@ -10,0 +11,0 @@ require('tailwindcss-patch');

@@ -8,2 +8,3 @@ 'use strict';

require('path');
require('tailwindcss-mangle-shared');
require('tailwindcss-mangle-core');

@@ -10,0 +11,0 @@ require('tailwindcss-patch');

{
"name": "unplugin-tailwindcss-mangle",
"version": "0.1.4",
"version": "1.2.1",
"description": "mangle tailwindcss utilities class plugin. support vite and webpack!",

@@ -64,5 +64,6 @@ "main": "./dist/index.js",

"micromatch": "^4.0.5",
"tailwindcss-mangle-core": "^1.2.1",
"tailwindcss-patch": "^1.2.1",
"unplugin": "^1.3.1",
"tailwindcss-mangle-core": "^1.0.0",
"tailwindcss-patch": "^1.1.1"
"tailwindcss-mangle-shared": "^1.2.1"
},

@@ -69,0 +70,0 @@ "publishConfig": {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc