unplugin-tailwindcss-mangle 5.1.2-alpha.1 → 5.1.3

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/rollup.d.cts CHANGED
@@ -1,6 +1,6 @@
1
- import * as rollup from 'rollup';
2
- import * as _tailwindcss_mangle_config from '@tailwindcss-mangle/config';
1
+ import * as _$_tailwindcss_mangle_config0 from "@tailwindcss-mangle/config";
2
+ import * as _$rollup from "rollup";
3
3
 
4
- declare const _default: (options?: _tailwindcss_mangle_config.TransformerOptions | undefined) => rollup.Plugin<any> | rollup.Plugin<any>[];
5
-
6
- export = _default;
4
+ //#region src/rollup.d.ts
5
+ declare const _default: (options?: _$_tailwindcss_mangle_config0.TransformerOptions | undefined) => _$rollup.Plugin<any> | _$rollup.Plugin<any>[];
6
+ export = _default;
package/dist/rollup.d.ts CHANGED
@@ -1,6 +1,7 @@
1
- import * as rollup from 'rollup';
2
- import * as _tailwindcss_mangle_config from '@tailwindcss-mangle/config';
1
+ import * as _$_tailwindcss_mangle_config0 from "@tailwindcss-mangle/config";
2
+ import * as _$rollup from "rollup";
3
3
 
4
- declare const _default: (options?: _tailwindcss_mangle_config.TransformerOptions | undefined) => rollup.Plugin<any> | rollup.Plugin<any>[];
5
-
6
- export { _default as default };
4
+ //#region src/rollup.d.ts
5
+ declare const _default: (options?: _$_tailwindcss_mangle_config0.TransformerOptions | undefined) => _$rollup.Plugin<any> | _$rollup.Plugin<any>[];
6
+ //#endregion
7
+ export { _default as default };
package/dist/rollup.js CHANGED
@@ -1,11 +1,5 @@
1
- import {
2
- plugin_default
3
- } from "./chunk-QNSTX4YB.js";
4
- import "./chunk-TVEX3BIF.js";
5
- import "./chunk-BYKP5MUG.js";
6
-
7
- // src/rollup.ts
8
- var rollup_default = plugin_default.rollup;
9
- export {
10
- rollup_default as default
11
- };
1
+ import { t as unplugin } from "./core-ClSeSCtC.js";
2
+ //#region src/rollup.ts
3
+ var rollup_default = unplugin.rollup;
4
+ //#endregion
5
+ export { rollup_default as default };
@@ -0,0 +1,48 @@
1
+ import path from "pathe";
2
+ import fs from "node:fs/promises";
3
+ import process from "node:process";
4
+ import { defaultMangleClassFilter, groupBy, isMap, isRegexp } from "@tailwindcss-mangle/shared";
5
+ //#region src/constants.ts
6
+ const pluginName = "unplugin-tailwindcss-mangle";
7
+ //#endregion
8
+ //#region src/utils.ts
9
+ function escapeStringRegexp(str) {
10
+ if (typeof str !== "string") throw new TypeError("Expected a string");
11
+ return str.replaceAll(/[$()*+.?[\\\]^{|}]/g, "\\$&").replaceAll("-", "\\x2d");
12
+ }
13
+ function getGroupedEntries(entries, options = {
14
+ cssMatcher(file) {
15
+ return /\.css$/.test(file);
16
+ },
17
+ htmlMatcher(file) {
18
+ return /\.html?$/.test(file);
19
+ },
20
+ jsMatcher(file) {
21
+ return /\.[cm]?js$/.test(file);
22
+ }
23
+ }) {
24
+ const { cssMatcher, htmlMatcher, jsMatcher } = options;
25
+ const groupedEntries = groupBy(entries, ([file]) => {
26
+ if (cssMatcher(file)) return "css";
27
+ else if (htmlMatcher(file)) return "html";
28
+ else if (jsMatcher(file)) return "js";
29
+ else return "other";
30
+ });
31
+ if (!groupedEntries["css"]) groupedEntries["css"] = [];
32
+ if (!groupedEntries["html"]) groupedEntries["html"] = [];
33
+ if (!groupedEntries["js"]) groupedEntries["js"] = [];
34
+ if (!groupedEntries["other"]) groupedEntries["other"] = [];
35
+ return groupedEntries;
36
+ }
37
+ function getCacheDir(basedir = process.cwd()) {
38
+ return path.resolve(basedir, "node_modules/.cache", pluginName);
39
+ }
40
+ async function ensureDir(p) {
41
+ try {
42
+ await fs.access(p);
43
+ } catch {
44
+ await fs.mkdir(p, { recursive: true });
45
+ }
46
+ }
47
+ //#endregion
48
+ export { getGroupedEntries as a, pluginName as c, getCacheDir as i, ensureDir as n, isMap as o, escapeStringRegexp as r, isRegexp as s, defaultMangleClassFilter as t };
@@ -0,0 +1,108 @@
1
+ //#region \0rolldown/runtime.js
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __copyProps = (to, from, except, desc) => {
9
+ if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
10
+ key = keys[i];
11
+ if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
12
+ get: ((k) => from[k]).bind(null, key),
13
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
14
+ });
15
+ }
16
+ return to;
17
+ };
18
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
19
+ value: mod,
20
+ enumerable: true
21
+ }) : target, mod));
22
+ //#endregion
23
+ let pathe = require("pathe");
24
+ pathe = __toESM(pathe, 1);
25
+ let node_fs_promises = require("node:fs/promises");
26
+ node_fs_promises = __toESM(node_fs_promises, 1);
27
+ let node_process = require("node:process");
28
+ node_process = __toESM(node_process, 1);
29
+ let _tailwindcss_mangle_shared = require("@tailwindcss-mangle/shared");
30
+ //#region src/constants.ts
31
+ const pluginName = "unplugin-tailwindcss-mangle";
32
+ //#endregion
33
+ //#region src/utils.ts
34
+ function escapeStringRegexp(str) {
35
+ if (typeof str !== "string") throw new TypeError("Expected a string");
36
+ return str.replaceAll(/[$()*+.?[\\\]^{|}]/g, "\\$&").replaceAll("-", "\\x2d");
37
+ }
38
+ function getGroupedEntries(entries, options = {
39
+ cssMatcher(file) {
40
+ return /\.css$/.test(file);
41
+ },
42
+ htmlMatcher(file) {
43
+ return /\.html?$/.test(file);
44
+ },
45
+ jsMatcher(file) {
46
+ return /\.[cm]?js$/.test(file);
47
+ }
48
+ }) {
49
+ const { cssMatcher, htmlMatcher, jsMatcher } = options;
50
+ const groupedEntries = (0, _tailwindcss_mangle_shared.groupBy)(entries, ([file]) => {
51
+ if (cssMatcher(file)) return "css";
52
+ else if (htmlMatcher(file)) return "html";
53
+ else if (jsMatcher(file)) return "js";
54
+ else return "other";
55
+ });
56
+ if (!groupedEntries["css"]) groupedEntries["css"] = [];
57
+ if (!groupedEntries["html"]) groupedEntries["html"] = [];
58
+ if (!groupedEntries["js"]) groupedEntries["js"] = [];
59
+ if (!groupedEntries["other"]) groupedEntries["other"] = [];
60
+ return groupedEntries;
61
+ }
62
+ function getCacheDir(basedir = node_process.default.cwd()) {
63
+ return pathe.default.resolve(basedir, "node_modules/.cache", pluginName);
64
+ }
65
+ async function ensureDir(p) {
66
+ try {
67
+ await node_fs_promises.default.access(p);
68
+ } catch {
69
+ await node_fs_promises.default.mkdir(p, { recursive: true });
70
+ }
71
+ }
72
+ //#endregion
73
+ Object.defineProperty(exports, "__toESM", {
74
+ enumerable: true,
75
+ get: function() {
76
+ return __toESM;
77
+ }
78
+ });
79
+ Object.defineProperty(exports, "ensureDir", {
80
+ enumerable: true,
81
+ get: function() {
82
+ return ensureDir;
83
+ }
84
+ });
85
+ Object.defineProperty(exports, "escapeStringRegexp", {
86
+ enumerable: true,
87
+ get: function() {
88
+ return escapeStringRegexp;
89
+ }
90
+ });
91
+ Object.defineProperty(exports, "getCacheDir", {
92
+ enumerable: true,
93
+ get: function() {
94
+ return getCacheDir;
95
+ }
96
+ });
97
+ Object.defineProperty(exports, "getGroupedEntries", {
98
+ enumerable: true,
99
+ get: function() {
100
+ return getGroupedEntries;
101
+ }
102
+ });
103
+ Object.defineProperty(exports, "pluginName", {
104
+ enumerable: true,
105
+ get: function() {
106
+ return pluginName;
107
+ }
108
+ });
package/dist/utils.cjs CHANGED
@@ -1,18 +1,25 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
-
3
-
4
-
5
-
6
-
7
-
8
-
9
- var _chunkQGD6AWGRcjs = require('./chunk-QGD6AWGR.cjs');
10
-
11
-
12
-
13
-
14
-
15
-
16
-
17
-
18
- exports.defaultMangleClassFilter = _chunkQGD6AWGRcjs.defaultMangleClassFilter; exports.ensureDir = _chunkQGD6AWGRcjs.ensureDir; exports.escapeStringRegexp = _chunkQGD6AWGRcjs.escapeStringRegexp; exports.getCacheDir = _chunkQGD6AWGRcjs.getCacheDir; exports.getGroupedEntries = _chunkQGD6AWGRcjs.getGroupedEntries; exports.isMap = _chunkQGD6AWGRcjs.isMap; exports.isRegexp = _chunkQGD6AWGRcjs.isRegexp;
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ const require_utils = require("./utils-DnTj6vm7.cjs");
3
+ let _tailwindcss_mangle_shared = require("@tailwindcss-mangle/shared");
4
+ Object.defineProperty(exports, "defaultMangleClassFilter", {
5
+ enumerable: true,
6
+ get: function() {
7
+ return _tailwindcss_mangle_shared.defaultMangleClassFilter;
8
+ }
9
+ });
10
+ exports.ensureDir = require_utils.ensureDir;
11
+ exports.escapeStringRegexp = require_utils.escapeStringRegexp;
12
+ exports.getCacheDir = require_utils.getCacheDir;
13
+ exports.getGroupedEntries = require_utils.getGroupedEntries;
14
+ Object.defineProperty(exports, "isMap", {
15
+ enumerable: true,
16
+ get: function() {
17
+ return _tailwindcss_mangle_shared.isMap;
18
+ }
19
+ });
20
+ Object.defineProperty(exports, "isRegexp", {
21
+ enumerable: true,
22
+ get: function() {
23
+ return _tailwindcss_mangle_shared.isRegexp;
24
+ }
25
+ });
package/dist/utils.d.cts CHANGED
@@ -1,12 +1,13 @@
1
- export { defaultMangleClassFilter, isMap, isRegexp } from '@tailwindcss-mangle/shared';
1
+ import { defaultMangleClassFilter, isMap, isRegexp } from "@tailwindcss-mangle/shared";
2
2
 
3
+ //#region src/utils.d.ts
3
4
  declare function escapeStringRegexp(str: string): string;
4
5
  declare function getGroupedEntries<T>(entries: [string, T][], options?: {
5
- cssMatcher(file: string): boolean;
6
- htmlMatcher(file: string): boolean;
7
- jsMatcher(file: string): boolean;
6
+ cssMatcher(file: string): boolean;
7
+ htmlMatcher(file: string): boolean;
8
+ jsMatcher(file: string): boolean;
8
9
  }): Record<"css" | "html" | "js" | "other", [string, T][]>;
9
10
  declare function getCacheDir(basedir?: string): string;
10
11
  declare function ensureDir(p: string): Promise<void>;
11
-
12
- export { ensureDir, escapeStringRegexp, getCacheDir, getGroupedEntries };
12
+ //#endregion
13
+ export { defaultMangleClassFilter, ensureDir, escapeStringRegexp, getCacheDir, getGroupedEntries, isMap, isRegexp };
package/dist/utils.d.ts CHANGED
@@ -1,12 +1,13 @@
1
- export { defaultMangleClassFilter, isMap, isRegexp } from '@tailwindcss-mangle/shared';
1
+ import { defaultMangleClassFilter, isMap, isRegexp } from "@tailwindcss-mangle/shared";
2
2
 
3
+ //#region src/utils.d.ts
3
4
  declare function escapeStringRegexp(str: string): string;
4
5
  declare function getGroupedEntries<T>(entries: [string, T][], options?: {
5
- cssMatcher(file: string): boolean;
6
- htmlMatcher(file: string): boolean;
7
- jsMatcher(file: string): boolean;
6
+ cssMatcher(file: string): boolean;
7
+ htmlMatcher(file: string): boolean;
8
+ jsMatcher(file: string): boolean;
8
9
  }): Record<"css" | "html" | "js" | "other", [string, T][]>;
9
10
  declare function getCacheDir(basedir?: string): string;
10
11
  declare function ensureDir(p: string): Promise<void>;
11
-
12
- export { ensureDir, escapeStringRegexp, getCacheDir, getGroupedEntries };
12
+ //#endregion
13
+ export { defaultMangleClassFilter, ensureDir, escapeStringRegexp, getCacheDir, getGroupedEntries, isMap, isRegexp };
package/dist/utils.js CHANGED
@@ -1,19 +1,2 @@
1
- import {
2
- defaultMangleClassFilter,
3
- ensureDir,
4
- escapeStringRegexp,
5
- getCacheDir,
6
- getGroupedEntries,
7
- isMap,
8
- isRegexp
9
- } from "./chunk-TVEX3BIF.js";
10
- import "./chunk-BYKP5MUG.js";
11
- export {
12
- defaultMangleClassFilter,
13
- ensureDir,
14
- escapeStringRegexp,
15
- getCacheDir,
16
- getGroupedEntries,
17
- isMap,
18
- isRegexp
19
- };
1
+ import { a as getGroupedEntries, i as getCacheDir, n as ensureDir, o as isMap, r as escapeStringRegexp, s as isRegexp, t as defaultMangleClassFilter } from "./utils-CT4s62m9.js";
2
+ export { defaultMangleClassFilter, ensureDir, escapeStringRegexp, getCacheDir, getGroupedEntries, isMap, isRegexp };
package/dist/vite.cjs CHANGED
@@ -1,12 +1,4 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
-
3
- var _chunkA24OOU3Ccjs = require('./chunk-A24OOU3C.cjs');
4
- require('./chunk-QGD6AWGR.cjs');
5
-
6
- // src/vite.ts
7
- var vite_default = _chunkA24OOU3Ccjs.plugin_default.vite;
8
-
9
-
10
- exports.default = vite_default;
11
-
12
- module.exports = exports.default;
1
+ //#region src/vite.ts
2
+ var vite_default = require("./core-C8BPj6VA.cjs").unplugin.vite;
3
+ //#endregion
4
+ module.exports = vite_default;
package/dist/vite.d.cts CHANGED
@@ -1,6 +1,6 @@
1
- import * as vite from 'vite';
2
- import * as _tailwindcss_mangle_config from '@tailwindcss-mangle/config';
1
+ import * as _$_tailwindcss_mangle_config0 from "@tailwindcss-mangle/config";
2
+ import * as _$vite from "vite";
3
3
 
4
- declare const _default: (options?: _tailwindcss_mangle_config.TransformerOptions | undefined) => vite.Plugin<any> | vite.Plugin<any>[];
5
-
6
- export = _default;
4
+ //#region src/vite.d.ts
5
+ declare const _default: (options?: _$_tailwindcss_mangle_config0.TransformerOptions | undefined) => _$vite.Plugin<any> | _$vite.Plugin<any>[];
6
+ export = _default;
package/dist/vite.d.ts CHANGED
@@ -1,6 +1,7 @@
1
- import * as vite from 'vite';
2
- import * as _tailwindcss_mangle_config from '@tailwindcss-mangle/config';
1
+ import * as _$_tailwindcss_mangle_config0 from "@tailwindcss-mangle/config";
2
+ import * as _$vite from "vite";
3
3
 
4
- declare const _default: (options?: _tailwindcss_mangle_config.TransformerOptions | undefined) => vite.Plugin<any> | vite.Plugin<any>[];
5
-
6
- export { _default as default };
4
+ //#region src/vite.d.ts
5
+ declare const _default: (options?: _$_tailwindcss_mangle_config0.TransformerOptions | undefined) => _$vite.Plugin<any> | _$vite.Plugin<any>[];
6
+ //#endregion
7
+ export { _default as default };
package/dist/vite.js CHANGED
@@ -1,11 +1,5 @@
1
- import {
2
- plugin_default
3
- } from "./chunk-QNSTX4YB.js";
4
- import "./chunk-TVEX3BIF.js";
5
- import "./chunk-BYKP5MUG.js";
6
-
7
- // src/vite.ts
8
- var vite_default = plugin_default.vite;
9
- export {
10
- vite_default as default
11
- };
1
+ import { t as unplugin } from "./core-ClSeSCtC.js";
2
+ //#region src/vite.ts
3
+ var vite_default = unplugin.vite;
4
+ //#endregion
5
+ export { vite_default as default };
package/dist/webpack.cjs CHANGED
@@ -1,12 +1,4 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
-
3
- var _chunkA24OOU3Ccjs = require('./chunk-A24OOU3C.cjs');
4
- require('./chunk-QGD6AWGR.cjs');
5
-
6
- // src/webpack.ts
7
- var webpack_default = _chunkA24OOU3Ccjs.plugin_default.webpack;
8
-
9
-
10
- exports.default = webpack_default;
11
-
12
- module.exports = exports.default;
1
+ //#region src/webpack.ts
2
+ var webpack_default = require("./core-C8BPj6VA.cjs").unplugin.webpack;
3
+ //#endregion
4
+ module.exports = webpack_default;
@@ -1,6 +1,6 @@
1
- import * as webpack from 'webpack';
2
- import * as _tailwindcss_mangle_config from '@tailwindcss-mangle/config';
1
+ import * as _$_tailwindcss_mangle_config0 from "@tailwindcss-mangle/config";
2
+ import * as _$webpack from "webpack";
3
3
 
4
- declare const _default: (options?: _tailwindcss_mangle_config.TransformerOptions | undefined) => webpack.WebpackPluginInstance;
5
-
6
- export = _default;
4
+ //#region src/webpack.d.ts
5
+ declare const _default: (options?: _$_tailwindcss_mangle_config0.TransformerOptions | undefined) => _$webpack.WebpackPluginInstance;
6
+ export = _default;
package/dist/webpack.d.ts CHANGED
@@ -1,6 +1,7 @@
1
- import * as webpack from 'webpack';
2
- import * as _tailwindcss_mangle_config from '@tailwindcss-mangle/config';
1
+ import * as _$_tailwindcss_mangle_config0 from "@tailwindcss-mangle/config";
2
+ import * as _$webpack from "webpack";
3
3
 
4
- declare const _default: (options?: _tailwindcss_mangle_config.TransformerOptions | undefined) => webpack.WebpackPluginInstance;
5
-
6
- export { _default as default };
4
+ //#region src/webpack.d.ts
5
+ declare const _default: (options?: _$_tailwindcss_mangle_config0.TransformerOptions | undefined) => _$webpack.WebpackPluginInstance;
6
+ //#endregion
7
+ export { _default as default };
package/dist/webpack.js CHANGED
@@ -1,11 +1,5 @@
1
- import {
2
- plugin_default
3
- } from "./chunk-QNSTX4YB.js";
4
- import "./chunk-TVEX3BIF.js";
5
- import "./chunk-BYKP5MUG.js";
6
-
7
- // src/webpack.ts
8
- var webpack_default = plugin_default.webpack;
9
- export {
10
- webpack_default as default
11
- };
1
+ import { t as unplugin } from "./core-ClSeSCtC.js";
2
+ //#region src/webpack.ts
3
+ var webpack_default = unplugin.webpack;
4
+ //#endregion
5
+ export { webpack_default as default };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "unplugin-tailwindcss-mangle",
3
3
  "type": "module",
4
- "version": "5.1.2-alpha.1",
4
+ "version": "5.1.3",
5
5
  "description": "mangle tailwindcss utilities class plugin. support vite and webpack!",
6
6
  "author": "ice breaker <1324318532@qq.com>",
7
7
  "license": "MIT",
@@ -74,17 +74,17 @@
74
74
  "is-css-request": "^1.0.1",
75
75
  "magic-string": "^0.30.21",
76
76
  "unplugin": "^3.0.0",
77
- "@tailwindcss-mangle/config": "^7.0.0-alpha.1",
78
- "@tailwindcss-mangle/core": "^5.1.2-alpha.1",
79
- "@tailwindcss-mangle/shared": "^4.1.4-alpha.0"
77
+ "@tailwindcss-mangle/config": "^7.0.1",
78
+ "@tailwindcss-mangle/core": "^5.1.3",
79
+ "@tailwindcss-mangle/shared": "^4.1.5"
80
80
  },
81
81
  "publishConfig": {
82
82
  "access": "public",
83
83
  "registry": "https://registry.npmjs.org/"
84
84
  },
85
85
  "scripts": {
86
- "dev": "tsup --watch --sourcemap",
87
- "build": "tsup",
86
+ "dev": "tsdown --watch --sourcemap",
87
+ "build": "tsdown",
88
88
  "test": "vitest run --coverage.enabled",
89
89
  "test:dev": "vitest",
90
90
  "test:e2e": "TWM_APPS_E2E=1 vitest run test/apps.e2e.test.ts",