unplugin-tailwindcss-mangle 0.0.5 → 0.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/nuxt.js CHANGED
@@ -2,48 +2,24 @@
2
2
 
3
3
  var index = require('./index.js');
4
4
  require('unplugin');
5
- require('tailwindcss-patch');
5
+ require('micromatch');
6
+ require('fs');
7
+ require('path');
6
8
  require('parse5');
7
- require('@babel/generator');
8
- require('@babel/parser');
9
- require('@babel/traverse');
9
+ require('@babel/core');
10
10
  require('postcss');
11
11
  require('postcss-selector-parser');
12
-
13
- /******************************************************************************
14
- Copyright (c) Microsoft Corporation.
15
-
16
- Permission to use, copy, modify, and/or distribute this software for any
17
- purpose with or without fee is hereby granted.
18
-
19
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
20
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
21
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
22
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
23
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
24
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
25
- PERFORMANCE OF THIS SOFTWARE.
26
- ***************************************************************************** */
27
-
28
- function __awaiter(thisArg, _arguments, P, generator) {
29
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
30
- return new (P || (P = Promise))(function (resolve, reject) {
31
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
32
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
33
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
34
- step((generator = generator.apply(thisArg, _arguments || [])).next());
35
- });
36
- }
12
+ require('tailwindcss-patch');
37
13
 
38
14
  function nuxt (options = {}, nuxt) {
39
- nuxt.hook('webpack:config', (config) => __awaiter(this, void 0, void 0, function* () {
15
+ nuxt.hook('webpack:config', async (config) => {
40
16
  config.plugins = config.plugins || [];
41
17
  config.plugins.unshift(index.unplugin.webpack(options));
42
- }));
43
- nuxt.hook('vite:extendConfig', (config) => __awaiter(this, void 0, void 0, function* () {
18
+ });
19
+ nuxt.hook('vite:extendConfig', async (config) => {
44
20
  config.plugins = config.plugins || [];
45
21
  config.plugins.push(index.unplugin.vite(options));
46
- }));
22
+ });
47
23
  }
48
24
 
49
25
  module.exports = nuxt;
package/dist/nuxt.mjs CHANGED
@@ -1,47 +1,23 @@
1
1
  import { unplugin } from './index.mjs';
2
2
  import 'unplugin';
3
- import 'tailwindcss-patch';
3
+ import 'micromatch';
4
+ import 'fs';
5
+ import 'path';
4
6
  import 'parse5';
5
- import '@babel/generator';
6
- import '@babel/parser';
7
- import '@babel/traverse';
7
+ import '@babel/core';
8
8
  import 'postcss';
9
9
  import 'postcss-selector-parser';
10
-
11
- /******************************************************************************
12
- Copyright (c) Microsoft Corporation.
13
-
14
- Permission to use, copy, modify, and/or distribute this software for any
15
- purpose with or without fee is hereby granted.
16
-
17
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
18
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
19
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
20
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
21
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
22
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
23
- PERFORMANCE OF THIS SOFTWARE.
24
- ***************************************************************************** */
25
-
26
- function __awaiter(thisArg, _arguments, P, generator) {
27
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
28
- return new (P || (P = Promise))(function (resolve, reject) {
29
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
30
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
31
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
32
- step((generator = generator.apply(thisArg, _arguments || [])).next());
33
- });
34
- }
10
+ import 'tailwindcss-patch';
35
11
 
36
12
  function nuxt (options = {}, nuxt) {
37
- nuxt.hook('webpack:config', (config) => __awaiter(this, void 0, void 0, function* () {
13
+ nuxt.hook('webpack:config', async (config) => {
38
14
  config.plugins = config.plugins || [];
39
15
  config.plugins.unshift(unplugin.webpack(options));
40
- }));
41
- nuxt.hook('vite:extendConfig', (config) => __awaiter(this, void 0, void 0, function* () {
16
+ });
17
+ nuxt.hook('vite:extendConfig', async (config) => {
42
18
  config.plugins = config.plugins || [];
43
19
  config.plugins.push(unplugin.vite(options));
44
- }));
20
+ });
45
21
  }
46
22
 
47
23
  export { nuxt as default };
@@ -0,0 +1,11 @@
1
+ import type { Options, ClassSetOutputOptions, ClassMapOutputOptions } from './types';
2
+ import ClassGenerator from './classGenerator';
3
+ export declare function getOptions(options?: Options | undefined): {
4
+ getCachedClassSet: () => Set<string>;
5
+ classGenerator: ClassGenerator;
6
+ includeMatcher: (file: string) => boolean;
7
+ excludeMatcher: (file: string) => boolean;
8
+ isInclude: (file: string) => boolean;
9
+ classSetOutputOptions: ClassSetOutputOptions;
10
+ classMapOutputOptions: ClassMapOutputOptions;
11
+ };
package/dist/rollup.js CHANGED
@@ -2,13 +2,14 @@
2
2
 
3
3
  var index = require('./index.js');
4
4
  require('unplugin');
5
- require('tailwindcss-patch');
5
+ require('micromatch');
6
+ require('fs');
7
+ require('path');
6
8
  require('parse5');
7
- require('@babel/generator');
8
- require('@babel/parser');
9
- require('@babel/traverse');
9
+ require('@babel/core');
10
10
  require('postcss');
11
11
  require('postcss-selector-parser');
12
+ require('tailwindcss-patch');
12
13
 
13
14
  var rollup = index.unplugin.rollup;
14
15
 
package/dist/rollup.mjs CHANGED
@@ -1,12 +1,13 @@
1
1
  import { unplugin } from './index.mjs';
2
2
  import 'unplugin';
3
- import 'tailwindcss-patch';
3
+ import 'micromatch';
4
+ import 'fs';
5
+ import 'path';
4
6
  import 'parse5';
5
- import '@babel/generator';
6
- import '@babel/parser';
7
- import '@babel/traverse';
7
+ import '@babel/core';
8
8
  import 'postcss';
9
9
  import 'postcss-selector-parser';
10
+ import 'tailwindcss-patch';
10
11
 
11
12
  var rollup = unplugin.rollup;
12
13
 
package/dist/types.d.ts CHANGED
@@ -17,11 +17,23 @@ export interface IClassGenerator {
17
17
  newClassSize: number;
18
18
  context: Record<string, any>;
19
19
  }
20
- export type { TraverseOptions } from '@babel/traverse';
21
20
  export interface IHandlerOptions {
22
21
  runtimeSet: Set<string>;
23
22
  classGenerator: ClassGenerator;
24
23
  }
24
+ export interface ClassSetOutputOptions {
25
+ filename: string;
26
+ dir?: string;
27
+ type: 'all' | 'partial';
28
+ }
29
+ export interface ClassMapOutputOptions {
30
+ filename: string;
31
+ dir?: string;
32
+ }
25
33
  export interface Options {
26
34
  classGenerator?: IClassGeneratorOptions;
35
+ exclude?: string[];
36
+ include?: string[];
37
+ classSetOutput?: boolean | ClassSetOutputOptions;
38
+ classMapOutput?: boolean | ClassMapOutputOptions;
27
39
  }
package/dist/utils.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import type { IClassGeneratorOptions, IClassGenerator } from './types';
2
+ export declare const isMangleClass: (className: string) => boolean;
2
3
  export declare function groupBy<T>(arr: T[], cb: (arg: T) => string): Record<string, T[]>;
3
4
  export declare function getGroupedEntries<T>(entries: [string, T][], options?: {
4
5
  cssMatcher(file: string): boolean;
@@ -12,3 +13,7 @@ export declare function isRegexp(value: unknown): boolean;
12
13
  export declare function isMap(value: unknown): boolean;
13
14
  export declare function regExpTest(arr: (string | RegExp)[] | undefined, str: string): boolean;
14
15
  export declare function escapeStringRegexp(str: string): string;
16
+ export declare function createGlobMatcher(pattern: string | string[] | undefined, fallbackValue?: boolean): (file: string) => boolean;
17
+ export declare function getCacheDir(basedir?: string): string;
18
+ export declare function mkCacheDirectory(cwd?: string): string;
19
+ export declare function cacheDump(filename: string, data: any[] | Set<any>, basedir?: string): void;
package/dist/vite.js CHANGED
@@ -2,13 +2,14 @@
2
2
 
3
3
  var index = require('./index.js');
4
4
  require('unplugin');
5
- require('tailwindcss-patch');
5
+ require('micromatch');
6
+ require('fs');
7
+ require('path');
6
8
  require('parse5');
7
- require('@babel/generator');
8
- require('@babel/parser');
9
- require('@babel/traverse');
9
+ require('@babel/core');
10
10
  require('postcss');
11
11
  require('postcss-selector-parser');
12
+ require('tailwindcss-patch');
12
13
 
13
14
  var vite = index.unplugin.vite;
14
15
 
package/dist/vite.mjs CHANGED
@@ -1,12 +1,13 @@
1
1
  import { unplugin } from './index.mjs';
2
2
  import 'unplugin';
3
- import 'tailwindcss-patch';
3
+ import 'micromatch';
4
+ import 'fs';
5
+ import 'path';
4
6
  import 'parse5';
5
- import '@babel/generator';
6
- import '@babel/parser';
7
- import '@babel/traverse';
7
+ import '@babel/core';
8
8
  import 'postcss';
9
9
  import 'postcss-selector-parser';
10
+ import 'tailwindcss-patch';
10
11
 
11
12
  var vite = unplugin.vite;
12
13
 
package/dist/webpack.js CHANGED
@@ -2,13 +2,14 @@
2
2
 
3
3
  var index = require('./index.js');
4
4
  require('unplugin');
5
- require('tailwindcss-patch');
5
+ require('micromatch');
6
+ require('fs');
7
+ require('path');
6
8
  require('parse5');
7
- require('@babel/generator');
8
- require('@babel/parser');
9
- require('@babel/traverse');
9
+ require('@babel/core');
10
10
  require('postcss');
11
11
  require('postcss-selector-parser');
12
+ require('tailwindcss-patch');
12
13
 
13
14
  var webpack = index.unplugin.webpack;
14
15
 
package/dist/webpack.mjs CHANGED
@@ -1,12 +1,13 @@
1
1
  import { unplugin } from './index.mjs';
2
2
  import 'unplugin';
3
- import 'tailwindcss-patch';
3
+ import 'micromatch';
4
+ import 'fs';
5
+ import 'path';
4
6
  import 'parse5';
5
- import '@babel/generator';
6
- import '@babel/parser';
7
- import '@babel/traverse';
7
+ import '@babel/core';
8
8
  import 'postcss';
9
9
  import 'postcss-selector-parser';
10
+ import 'tailwindcss-patch';
10
11
 
11
12
  var webpack = unplugin.webpack;
12
13
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "unplugin-tailwindcss-mangle",
3
- "version": "0.0.5",
4
- "description": "mangle tailwindcss utilities class",
3
+ "version": "0.1.1",
4
+ "description": "mangle tailwindcss utilities class plugin. support vite and webpack!",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
7
7
  "types": "./dist/index.d.ts",
@@ -31,6 +31,11 @@
31
31
  "require": "./dist/esbuild.js",
32
32
  "import": "./dist/esbuild.mjs"
33
33
  },
34
+ "./nuxt": {
35
+ "types": "./dist/nuxt.d.ts",
36
+ "require": "./dist/nuxt.js",
37
+ "import": "./dist/nuxt.mjs"
38
+ },
34
39
  "./*": "./*"
35
40
  },
36
41
  "typesVersions": {
@@ -55,18 +60,15 @@
55
60
  "author": "SonOfMagic <qq1324318532@gmail.com>",
56
61
  "license": "MIT",
57
62
  "dependencies": {
58
- "@babel/generator": "^7.21.4",
59
- "@babel/parser": "^7.21.4",
60
- "@babel/traverse": "^7.21.4",
63
+ "@babel/core": "^7.21.4",
61
64
  "@babel/types": "^7.21.4",
62
- "acorn-walk": "^8.2.0",
63
- "escodegen": "^2.0.0",
65
+ "micromatch": "^4.0.5",
64
66
  "parse5": "^7.1.2",
65
- "postcss": "^8.4.22",
67
+ "postcss": "^8.4.23",
66
68
  "postcss-selector-parser": "^6.0.11",
67
69
  "semver": "^7.5.0",
68
70
  "unplugin": "^1.3.1",
69
- "tailwindcss-patch": "1.0.2"
71
+ "tailwindcss-patch": "1.1.0-rc.0"
70
72
  },
71
73
  "publishConfig": {
72
74
  "access": "public",
@@ -74,15 +76,15 @@
74
76
  },
75
77
  "devDependencies": {
76
78
  "@parse5/tools": "^0.1.0",
77
- "@types/babel__generator": "^7.6.4",
78
- "@types/babel__traverse": "^7.18.3",
79
+ "@types/babel__core": "^7.20.0",
79
80
  "@types/escodegen": "^0.0.7",
81
+ "@types/micromatch": "^4.0.2",
80
82
  "@types/semver": "^7.3.13",
81
83
  "pkg-types": "^1.0.2",
82
- "tailwindcss": "^3.3.1",
84
+ "tailwindcss": "^3.3.2",
83
85
  "tslib": "^2.5.0",
84
- "vite": "^4.2.2",
85
- "webpack": "^5.79.0"
86
+ "vite": "^4.3.3",
87
+ "webpack": "^5.81.0"
86
88
  },
87
89
  "homepage": "https://github.com/sonofmagic/tailwindcss-mangle",
88
90
  "repository": {
@@ -95,6 +97,6 @@
95
97
  "dev:tsc": "tsc -p tsconfig.json --sourceMap",
96
98
  "build:tsc": "tsc -p tsconfig.json",
97
99
  "test": "jest",
98
- "preinstall": "npx only-allow pnpm"
100
+ "_prepare": "tw-patch"
99
101
  }
100
102
  }