unplugin-tailwindcss-mangle 5.1.2 → 5.1.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/core-CKW7suJa.cjs +176 -0
- package/dist/core-DkEmrnoN.js +177 -0
- package/dist/esbuild.cjs +4 -12
- package/dist/esbuild.d.cts +3 -6
- package/dist/esbuild.d.ts +4 -6
- package/dist/esbuild.js +5 -11
- package/dist/index.cjs +2 -9
- package/dist/index.d.cts +3 -6
- package/dist/index.d.ts +4 -6
- package/dist/index.js +2 -8
- package/dist/loader.cjs +11 -15
- package/dist/loader.d.cts +5 -5
- package/dist/loader.d.ts +6 -5
- package/dist/loader.js +10 -14
- package/dist/nuxt.cjs +12 -19
- package/dist/nuxt.d.cts +5 -5
- package/dist/nuxt.d.ts +6 -5
- package/dist/nuxt.js +12 -18
- package/dist/rollup.cjs +4 -12
- package/dist/rollup.d.cts +3 -6
- package/dist/rollup.d.ts +4 -6
- package/dist/rollup.js +5 -11
- package/dist/utils-Q_tk8olP.js +48 -0
- package/dist/utils-oD9kPGI_.cjs +108 -0
- package/dist/utils.cjs +25 -18
- package/dist/utils.d.cts +7 -6
- package/dist/utils.d.ts +7 -6
- package/dist/utils.js +2 -19
- package/dist/vite.cjs +4 -12
- package/dist/vite.d.cts +3 -6
- package/dist/vite.d.ts +4 -6
- package/dist/vite.js +5 -11
- package/dist/webpack.cjs +4 -12
- package/dist/webpack.d.cts +3 -6
- package/dist/webpack.d.ts +4 -6
- package/dist/webpack.js +5 -11
- package/package.json +7 -7
- package/dist/chunk-A24OOU3C.cjs +0 -201
- package/dist/chunk-N7QTWOPD.js +0 -204
- package/dist/chunk-Q7X23R6B.js +0 -10
- package/dist/chunk-QGD6AWGR.cjs +0 -495
- package/dist/chunk-TVEX3BIF.js +0 -495
package/dist/rollup.d.cts
CHANGED
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
declare const _default: (options?: _tailwindcss_mangle_config.TransformerOptions | undefined) => rollup.Plugin<any> | rollup.Plugin<any>[];
|
|
5
|
-
|
|
6
|
-
export = _default;
|
|
1
|
+
//#region src/rollup.d.ts
|
|
2
|
+
declare const _default: (options?: import("@tailwindcss-mangle/config").TransformerOptions | undefined) => import("rollup").Plugin<any> | import("rollup").Plugin<any>[];
|
|
3
|
+
export = _default;
|
package/dist/rollup.d.ts
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
export { _default as default };
|
|
1
|
+
//#region src/rollup.d.ts
|
|
2
|
+
declare const _default: (options?: import("@tailwindcss-mangle/config").TransformerOptions | undefined) => import("rollup").Plugin<any> | import("rollup").Plugin<any>[];
|
|
3
|
+
//#endregion
|
|
4
|
+
export { _default as default };
|
package/dist/rollup.js
CHANGED
|
@@ -1,11 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
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-DkEmrnoN.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
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_utils = require("./utils-oD9kPGI_.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
|
-
|
|
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
|
-
|
|
6
|
-
|
|
7
|
-
|
|
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
|
-
|
|
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
|
-
|
|
6
|
-
|
|
7
|
-
|
|
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
|
-
|
|
3
|
-
ensureDir,
|
|
4
|
-
escapeStringRegexp,
|
|
5
|
-
getCacheDir,
|
|
6
|
-
getGroupedEntries,
|
|
7
|
-
isMap,
|
|
8
|
-
isRegexp
|
|
9
|
-
} from "./chunk-TVEX3BIF.js";
|
|
10
|
-
import "./chunk-Q7X23R6B.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-Q_tk8olP.js";
|
|
2
|
+
export { defaultMangleClassFilter, ensureDir, escapeStringRegexp, getCacheDir, getGroupedEntries, isMap, isRegexp };
|
package/dist/vite.cjs
CHANGED
|
@@ -1,12 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
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-CKW7suJa.cjs").unplugin.vite;
|
|
3
|
+
//#endregion
|
|
4
|
+
module.exports = vite_default;
|
package/dist/vite.d.cts
CHANGED
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
declare const _default: (options?: _tailwindcss_mangle_config.TransformerOptions | undefined) => vite.Plugin<any> | vite.Plugin<any>[];
|
|
5
|
-
|
|
6
|
-
export = _default;
|
|
1
|
+
//#region src/vite.d.ts
|
|
2
|
+
declare const _default: (options?: import("@tailwindcss-mangle/config").TransformerOptions | undefined) => import("vite").Plugin<any> | import("vite").Plugin<any>[];
|
|
3
|
+
export = _default;
|
package/dist/vite.d.ts
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
export { _default as default };
|
|
1
|
+
//#region src/vite.d.ts
|
|
2
|
+
declare const _default: (options?: import("@tailwindcss-mangle/config").TransformerOptions | undefined) => import("vite").Plugin<any> | import("vite").Plugin<any>[];
|
|
3
|
+
//#endregion
|
|
4
|
+
export { _default as default };
|
package/dist/vite.js
CHANGED
|
@@ -1,11 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
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-DkEmrnoN.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
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
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-CKW7suJa.cjs").unplugin.webpack;
|
|
3
|
+
//#endregion
|
|
4
|
+
module.exports = webpack_default;
|
package/dist/webpack.d.cts
CHANGED
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
declare const _default: (options?: _tailwindcss_mangle_config.TransformerOptions | undefined) => webpack.WebpackPluginInstance;
|
|
5
|
-
|
|
6
|
-
export = _default;
|
|
1
|
+
//#region src/webpack.d.ts
|
|
2
|
+
declare const _default: (options?: import("@tailwindcss-mangle/config").TransformerOptions | undefined) => import("webpack").WebpackPluginInstance;
|
|
3
|
+
export = _default;
|
package/dist/webpack.d.ts
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
export { _default as default };
|
|
1
|
+
//#region src/webpack.d.ts
|
|
2
|
+
declare const _default: (options?: import("@tailwindcss-mangle/config").TransformerOptions | undefined) => import("webpack").WebpackPluginInstance;
|
|
3
|
+
//#endregion
|
|
4
|
+
export { _default as default };
|
package/dist/webpack.js
CHANGED
|
@@ -1,11 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
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-DkEmrnoN.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.
|
|
4
|
+
"version": "5.1.4",
|
|
5
5
|
"description": "mangle tailwindcss utilities class plugin. support vite and webpack!",
|
|
6
6
|
"author": "ice breaker <1324318532@qq.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -70,21 +70,21 @@
|
|
|
70
70
|
"dist"
|
|
71
71
|
],
|
|
72
72
|
"dependencies": {
|
|
73
|
-
"@rollup/pluginutils": "^5.
|
|
73
|
+
"@rollup/pluginutils": "^5.4.0",
|
|
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.
|
|
78
|
-
"@tailwindcss-mangle/core": "^5.1.
|
|
79
|
-
"@tailwindcss-mangle/shared": "^4.1.
|
|
77
|
+
"@tailwindcss-mangle/config": "^7.0.2",
|
|
78
|
+
"@tailwindcss-mangle/core": "^5.1.5",
|
|
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": "
|
|
87
|
-
"build": "
|
|
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",
|
package/dist/chunk-A24OOU3C.cjs
DELETED
|
@@ -1,201 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var _chunkQGD6AWGRcjs = require('./chunk-QGD6AWGR.cjs');
|
|
6
|
-
|
|
7
|
-
// src/core/plugin.ts
|
|
8
|
-
var _unplugin = require('unplugin');
|
|
9
|
-
|
|
10
|
-
// src/core/factory.ts
|
|
11
|
-
var _pluginutils = require('@rollup/pluginutils');
|
|
12
|
-
var _core = require('@tailwindcss-mangle/core');
|
|
13
|
-
var _iscssrequest = require('is-css-request');
|
|
14
|
-
var WEBPACK_LOADER = _chunkQGD6AWGRcjs.posix.resolve(__dirname, false ? "../../dist/loader.cjs" : "./loader.cjs");
|
|
15
|
-
var JS_LIKE_EXTENSIONS = /* @__PURE__ */ new Set([".js", ".cjs", ".mjs", ".ts", ".cts", ".mts", ".jsx", ".tsx"]);
|
|
16
|
-
var HTML_LIKE_EXTENSIONS = /* @__PURE__ */ new Set([".html", ".htm"]);
|
|
17
|
-
var CSS_LIKE_LANGS = /* @__PURE__ */ new Set(["css", "less", "sass", "scss", "styl", "stylus", "pcss", "postcss", "sss"]);
|
|
18
|
-
var JS_LIKE_LANGS = /* @__PURE__ */ new Set(["js", "cjs", "mjs", "ts", "cts", "mts", "jsx", "tsx"]);
|
|
19
|
-
var HTML_LIKE_LANGS = /* @__PURE__ */ new Set(["html", "htm"]);
|
|
20
|
-
function normalizeLang(rawLang) {
|
|
21
|
-
if (!rawLang) {
|
|
22
|
-
return "";
|
|
23
|
-
}
|
|
24
|
-
return rawLang.toLowerCase().replace(/^\./, "");
|
|
25
|
-
}
|
|
26
|
-
function isLikelyMarkup(code) {
|
|
27
|
-
return /<[a-z][\w:-]*(?:\s|>)/i.test(code);
|
|
28
|
-
}
|
|
29
|
-
function isHtmlFileRequest(id) {
|
|
30
|
-
const cleanId = _nullishCoalesce(id.split("?")[0], () => ( id));
|
|
31
|
-
const ext = _chunkQGD6AWGRcjs.posix.extname(cleanId).toLowerCase();
|
|
32
|
-
return HTML_LIKE_EXTENSIONS.has(ext);
|
|
33
|
-
}
|
|
34
|
-
function resolveTransformKind(id, code) {
|
|
35
|
-
if (_iscssrequest.isCSSRequest.call(void 0, id)) {
|
|
36
|
-
return "css";
|
|
37
|
-
}
|
|
38
|
-
const cleanId = _nullishCoalesce(id.split("?")[0], () => ( id));
|
|
39
|
-
const ext = _chunkQGD6AWGRcjs.posix.extname(cleanId).toLowerCase();
|
|
40
|
-
const query = id.includes("?") ? id.slice(id.indexOf("?") + 1) : "";
|
|
41
|
-
const params = new URLSearchParams(query);
|
|
42
|
-
const type = _optionalChain([params, 'access', _ => _.get, 'call', _2 => _2("type"), 'optionalAccess', _3 => _3.toLowerCase, 'call', _4 => _4()]);
|
|
43
|
-
const lang = normalizeLang(params.get("lang"));
|
|
44
|
-
if (type === "style") {
|
|
45
|
-
return "css";
|
|
46
|
-
}
|
|
47
|
-
if (type === "script") {
|
|
48
|
-
return "js";
|
|
49
|
-
}
|
|
50
|
-
if (type === "template") {
|
|
51
|
-
if (lang && JS_LIKE_LANGS.has(lang)) {
|
|
52
|
-
return "js";
|
|
53
|
-
}
|
|
54
|
-
if (lang && HTML_LIKE_LANGS.has(lang)) {
|
|
55
|
-
return "html";
|
|
56
|
-
}
|
|
57
|
-
return isLikelyMarkup(code) ? "html" : "js";
|
|
58
|
-
}
|
|
59
|
-
if (lang) {
|
|
60
|
-
if (CSS_LIKE_LANGS.has(lang)) {
|
|
61
|
-
return "css";
|
|
62
|
-
}
|
|
63
|
-
if (JS_LIKE_LANGS.has(lang)) {
|
|
64
|
-
return "js";
|
|
65
|
-
}
|
|
66
|
-
if (HTML_LIKE_LANGS.has(lang)) {
|
|
67
|
-
return "html";
|
|
68
|
-
}
|
|
69
|
-
if (lang === "vue") {
|
|
70
|
-
return "vue";
|
|
71
|
-
}
|
|
72
|
-
if (lang === "svelte") {
|
|
73
|
-
return "svelte";
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
if (ext === ".vue") {
|
|
77
|
-
return "vue";
|
|
78
|
-
}
|
|
79
|
-
if (ext === ".svelte") {
|
|
80
|
-
return "svelte";
|
|
81
|
-
}
|
|
82
|
-
if (HTML_LIKE_EXTENSIONS.has(ext)) {
|
|
83
|
-
return "html";
|
|
84
|
-
}
|
|
85
|
-
if (JS_LIKE_EXTENSIONS.has(ext)) {
|
|
86
|
-
return "js";
|
|
87
|
-
}
|
|
88
|
-
return isLikelyMarkup(code) ? "html" : "js";
|
|
89
|
-
}
|
|
90
|
-
var factory = (options) => {
|
|
91
|
-
const ctx = new (0, _core.Context)();
|
|
92
|
-
let filter = _pluginutils.createFilter.call(void 0, _optionalChain([options, 'optionalAccess', _5 => _5.sources, 'optionalAccess', _6 => _6.include]), _optionalChain([options, 'optionalAccess', _7 => _7.sources, 'optionalAccess', _8 => _8.exclude]));
|
|
93
|
-
return [
|
|
94
|
-
{
|
|
95
|
-
name: `${_chunkQGD6AWGRcjs.pluginName}:pre`,
|
|
96
|
-
enforce: "pre",
|
|
97
|
-
async buildStart() {
|
|
98
|
-
const initOptions = options === void 0 ? {} : { transformerOptions: options };
|
|
99
|
-
await ctx.initConfig(initOptions);
|
|
100
|
-
filter = _pluginutils.createFilter.call(void 0, _optionalChain([ctx, 'access', _9 => _9.options, 'access', _10 => _10.sources, 'optionalAccess', _11 => _11.include]), _optionalChain([ctx, 'access', _12 => _12.options, 'access', _13 => _13.sources, 'optionalAccess', _14 => _14.exclude]));
|
|
101
|
-
}
|
|
102
|
-
},
|
|
103
|
-
{
|
|
104
|
-
name: `${_chunkQGD6AWGRcjs.pluginName}`,
|
|
105
|
-
transformInclude(id) {
|
|
106
|
-
const cleanId = _nullishCoalesce(id.split("?")[0], () => ( id));
|
|
107
|
-
if (isHtmlFileRequest(cleanId)) {
|
|
108
|
-
return false;
|
|
109
|
-
}
|
|
110
|
-
return filter(cleanId);
|
|
111
|
-
},
|
|
112
|
-
async transform(code, id) {
|
|
113
|
-
const opts = {
|
|
114
|
-
ctx,
|
|
115
|
-
id
|
|
116
|
-
};
|
|
117
|
-
const kind = resolveTransformKind(id, code);
|
|
118
|
-
const framework = _optionalChain([this, 'access', _15 => _15.getNativeBuildContext, 'optionalCall', _16 => _16(), 'access', _17 => _17.framework]);
|
|
119
|
-
if ((framework === "webpack" || framework === "rspack") && kind === "html" && isHtmlFileRequest(id)) {
|
|
120
|
-
return null;
|
|
121
|
-
}
|
|
122
|
-
switch (kind) {
|
|
123
|
-
case "css":
|
|
124
|
-
return await _core.cssHandler.call(void 0, code, opts);
|
|
125
|
-
case "vue":
|
|
126
|
-
return await _core.vueHandler.call(void 0, code, opts);
|
|
127
|
-
case "svelte":
|
|
128
|
-
return await _core.svelteHandler.call(void 0, code, opts);
|
|
129
|
-
case "html":
|
|
130
|
-
return _core.htmlHandler.call(void 0, code, opts);
|
|
131
|
-
case "js":
|
|
132
|
-
default:
|
|
133
|
-
return _core.jsHandler.call(void 0, code, opts);
|
|
134
|
-
}
|
|
135
|
-
},
|
|
136
|
-
webpack(compiler) {
|
|
137
|
-
const { NormalModule } = compiler.webpack;
|
|
138
|
-
compiler.hooks.compilation.tap(_chunkQGD6AWGRcjs.pluginName, (compilation) => {
|
|
139
|
-
NormalModule.getCompilationHooks(compilation).loader.tap(_chunkQGD6AWGRcjs.pluginName, (_loaderContext, module) => {
|
|
140
|
-
const idx = module.loaders.findIndex((x) => x.loader.includes("postcss-loader"));
|
|
141
|
-
if (idx > -1) {
|
|
142
|
-
module.loaders.splice(idx, 0, {
|
|
143
|
-
loader: WEBPACK_LOADER,
|
|
144
|
-
ident: null,
|
|
145
|
-
options: {
|
|
146
|
-
ctx
|
|
147
|
-
},
|
|
148
|
-
type: null
|
|
149
|
-
});
|
|
150
|
-
}
|
|
151
|
-
});
|
|
152
|
-
});
|
|
153
|
-
}
|
|
154
|
-
},
|
|
155
|
-
{
|
|
156
|
-
name: `${_chunkQGD6AWGRcjs.pluginName}:post`,
|
|
157
|
-
enforce: "post",
|
|
158
|
-
vite: {
|
|
159
|
-
transformIndexHtml(html) {
|
|
160
|
-
const { code } = _core.htmlHandler.call(void 0, html, { ctx });
|
|
161
|
-
return code;
|
|
162
|
-
}
|
|
163
|
-
},
|
|
164
|
-
webpack(compiler) {
|
|
165
|
-
const { Compilation, sources } = compiler.webpack;
|
|
166
|
-
const { ConcatSource } = sources;
|
|
167
|
-
compiler.hooks.compilation.tap(_chunkQGD6AWGRcjs.pluginName, (compilation) => {
|
|
168
|
-
compilation.hooks.processAssets.tapPromise(
|
|
169
|
-
{
|
|
170
|
-
name: _chunkQGD6AWGRcjs.pluginName,
|
|
171
|
-
stage: Compilation.PROCESS_ASSETS_STAGE_SUMMARIZE
|
|
172
|
-
},
|
|
173
|
-
async (assets) => {
|
|
174
|
-
const groupedEntries = _chunkQGD6AWGRcjs.getGroupedEntries.call(void 0, Object.entries(assets));
|
|
175
|
-
for (const [id, cssSource] of groupedEntries.css) {
|
|
176
|
-
const { code } = await _core.cssHandler.call(void 0, cssSource.source().toString(), {
|
|
177
|
-
id,
|
|
178
|
-
ctx
|
|
179
|
-
});
|
|
180
|
-
const source = new ConcatSource(code);
|
|
181
|
-
compilation.updateAsset(id, source);
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
);
|
|
185
|
-
});
|
|
186
|
-
},
|
|
187
|
-
writeBundle() {
|
|
188
|
-
ctx.dump();
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
];
|
|
192
|
-
};
|
|
193
|
-
var factory_default = factory;
|
|
194
|
-
|
|
195
|
-
// src/core/plugin.ts
|
|
196
|
-
var unplugin = _unplugin.createUnplugin.call(void 0, factory_default);
|
|
197
|
-
var plugin_default = unplugin;
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
exports.plugin_default = plugin_default;
|