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/chunk-N7QTWOPD.js
DELETED
|
@@ -1,204 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
getGroupedEntries,
|
|
3
|
-
pluginName,
|
|
4
|
-
posix
|
|
5
|
-
} from "./chunk-TVEX3BIF.js";
|
|
6
|
-
import {
|
|
7
|
-
__dirname
|
|
8
|
-
} from "./chunk-Q7X23R6B.js";
|
|
9
|
-
|
|
10
|
-
// src/core/plugin.ts
|
|
11
|
-
import { createUnplugin } from "unplugin";
|
|
12
|
-
|
|
13
|
-
// src/core/factory.ts
|
|
14
|
-
import { createFilter } from "@rollup/pluginutils";
|
|
15
|
-
import { Context, cssHandler, htmlHandler, jsHandler, svelteHandler, vueHandler } from "@tailwindcss-mangle/core";
|
|
16
|
-
import { isCSSRequest } from "is-css-request";
|
|
17
|
-
var WEBPACK_LOADER = posix.resolve(__dirname, false ? "../../dist/loader.cjs" : "./loader.cjs");
|
|
18
|
-
var JS_LIKE_EXTENSIONS = /* @__PURE__ */ new Set([".js", ".cjs", ".mjs", ".ts", ".cts", ".mts", ".jsx", ".tsx"]);
|
|
19
|
-
var HTML_LIKE_EXTENSIONS = /* @__PURE__ */ new Set([".html", ".htm"]);
|
|
20
|
-
var CSS_LIKE_LANGS = /* @__PURE__ */ new Set(["css", "less", "sass", "scss", "styl", "stylus", "pcss", "postcss", "sss"]);
|
|
21
|
-
var JS_LIKE_LANGS = /* @__PURE__ */ new Set(["js", "cjs", "mjs", "ts", "cts", "mts", "jsx", "tsx"]);
|
|
22
|
-
var HTML_LIKE_LANGS = /* @__PURE__ */ new Set(["html", "htm"]);
|
|
23
|
-
function normalizeLang(rawLang) {
|
|
24
|
-
if (!rawLang) {
|
|
25
|
-
return "";
|
|
26
|
-
}
|
|
27
|
-
return rawLang.toLowerCase().replace(/^\./, "");
|
|
28
|
-
}
|
|
29
|
-
function isLikelyMarkup(code) {
|
|
30
|
-
return /<[a-z][\w:-]*(?:\s|>)/i.test(code);
|
|
31
|
-
}
|
|
32
|
-
function isHtmlFileRequest(id) {
|
|
33
|
-
const cleanId = id.split("?")[0] ?? id;
|
|
34
|
-
const ext = posix.extname(cleanId).toLowerCase();
|
|
35
|
-
return HTML_LIKE_EXTENSIONS.has(ext);
|
|
36
|
-
}
|
|
37
|
-
function resolveTransformKind(id, code) {
|
|
38
|
-
if (isCSSRequest(id)) {
|
|
39
|
-
return "css";
|
|
40
|
-
}
|
|
41
|
-
const cleanId = id.split("?")[0] ?? id;
|
|
42
|
-
const ext = posix.extname(cleanId).toLowerCase();
|
|
43
|
-
const query = id.includes("?") ? id.slice(id.indexOf("?") + 1) : "";
|
|
44
|
-
const params = new URLSearchParams(query);
|
|
45
|
-
const type = params.get("type")?.toLowerCase();
|
|
46
|
-
const lang = normalizeLang(params.get("lang"));
|
|
47
|
-
if (type === "style") {
|
|
48
|
-
return "css";
|
|
49
|
-
}
|
|
50
|
-
if (type === "script") {
|
|
51
|
-
return "js";
|
|
52
|
-
}
|
|
53
|
-
if (type === "template") {
|
|
54
|
-
if (lang && JS_LIKE_LANGS.has(lang)) {
|
|
55
|
-
return "js";
|
|
56
|
-
}
|
|
57
|
-
if (lang && HTML_LIKE_LANGS.has(lang)) {
|
|
58
|
-
return "html";
|
|
59
|
-
}
|
|
60
|
-
return isLikelyMarkup(code) ? "html" : "js";
|
|
61
|
-
}
|
|
62
|
-
if (lang) {
|
|
63
|
-
if (CSS_LIKE_LANGS.has(lang)) {
|
|
64
|
-
return "css";
|
|
65
|
-
}
|
|
66
|
-
if (JS_LIKE_LANGS.has(lang)) {
|
|
67
|
-
return "js";
|
|
68
|
-
}
|
|
69
|
-
if (HTML_LIKE_LANGS.has(lang)) {
|
|
70
|
-
return "html";
|
|
71
|
-
}
|
|
72
|
-
if (lang === "vue") {
|
|
73
|
-
return "vue";
|
|
74
|
-
}
|
|
75
|
-
if (lang === "svelte") {
|
|
76
|
-
return "svelte";
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
if (ext === ".vue") {
|
|
80
|
-
return "vue";
|
|
81
|
-
}
|
|
82
|
-
if (ext === ".svelte") {
|
|
83
|
-
return "svelte";
|
|
84
|
-
}
|
|
85
|
-
if (HTML_LIKE_EXTENSIONS.has(ext)) {
|
|
86
|
-
return "html";
|
|
87
|
-
}
|
|
88
|
-
if (JS_LIKE_EXTENSIONS.has(ext)) {
|
|
89
|
-
return "js";
|
|
90
|
-
}
|
|
91
|
-
return isLikelyMarkup(code) ? "html" : "js";
|
|
92
|
-
}
|
|
93
|
-
var factory = (options) => {
|
|
94
|
-
const ctx = new Context();
|
|
95
|
-
let filter = createFilter(options?.sources?.include, options?.sources?.exclude);
|
|
96
|
-
return [
|
|
97
|
-
{
|
|
98
|
-
name: `${pluginName}:pre`,
|
|
99
|
-
enforce: "pre",
|
|
100
|
-
async buildStart() {
|
|
101
|
-
const initOptions = options === void 0 ? {} : { transformerOptions: options };
|
|
102
|
-
await ctx.initConfig(initOptions);
|
|
103
|
-
filter = createFilter(ctx.options.sources?.include, ctx.options.sources?.exclude);
|
|
104
|
-
}
|
|
105
|
-
},
|
|
106
|
-
{
|
|
107
|
-
name: `${pluginName}`,
|
|
108
|
-
transformInclude(id) {
|
|
109
|
-
const cleanId = id.split("?")[0] ?? id;
|
|
110
|
-
if (isHtmlFileRequest(cleanId)) {
|
|
111
|
-
return false;
|
|
112
|
-
}
|
|
113
|
-
return filter(cleanId);
|
|
114
|
-
},
|
|
115
|
-
async transform(code, id) {
|
|
116
|
-
const opts = {
|
|
117
|
-
ctx,
|
|
118
|
-
id
|
|
119
|
-
};
|
|
120
|
-
const kind = resolveTransformKind(id, code);
|
|
121
|
-
const framework = this.getNativeBuildContext?.().framework;
|
|
122
|
-
if ((framework === "webpack" || framework === "rspack") && kind === "html" && isHtmlFileRequest(id)) {
|
|
123
|
-
return null;
|
|
124
|
-
}
|
|
125
|
-
switch (kind) {
|
|
126
|
-
case "css":
|
|
127
|
-
return await cssHandler(code, opts);
|
|
128
|
-
case "vue":
|
|
129
|
-
return await vueHandler(code, opts);
|
|
130
|
-
case "svelte":
|
|
131
|
-
return await svelteHandler(code, opts);
|
|
132
|
-
case "html":
|
|
133
|
-
return htmlHandler(code, opts);
|
|
134
|
-
case "js":
|
|
135
|
-
default:
|
|
136
|
-
return jsHandler(code, opts);
|
|
137
|
-
}
|
|
138
|
-
},
|
|
139
|
-
webpack(compiler) {
|
|
140
|
-
const { NormalModule } = compiler.webpack;
|
|
141
|
-
compiler.hooks.compilation.tap(pluginName, (compilation) => {
|
|
142
|
-
NormalModule.getCompilationHooks(compilation).loader.tap(pluginName, (_loaderContext, module) => {
|
|
143
|
-
const idx = module.loaders.findIndex((x) => x.loader.includes("postcss-loader"));
|
|
144
|
-
if (idx > -1) {
|
|
145
|
-
module.loaders.splice(idx, 0, {
|
|
146
|
-
loader: WEBPACK_LOADER,
|
|
147
|
-
ident: null,
|
|
148
|
-
options: {
|
|
149
|
-
ctx
|
|
150
|
-
},
|
|
151
|
-
type: null
|
|
152
|
-
});
|
|
153
|
-
}
|
|
154
|
-
});
|
|
155
|
-
});
|
|
156
|
-
}
|
|
157
|
-
},
|
|
158
|
-
{
|
|
159
|
-
name: `${pluginName}:post`,
|
|
160
|
-
enforce: "post",
|
|
161
|
-
vite: {
|
|
162
|
-
transformIndexHtml(html) {
|
|
163
|
-
const { code } = htmlHandler(html, { ctx });
|
|
164
|
-
return code;
|
|
165
|
-
}
|
|
166
|
-
},
|
|
167
|
-
webpack(compiler) {
|
|
168
|
-
const { Compilation, sources } = compiler.webpack;
|
|
169
|
-
const { ConcatSource } = sources;
|
|
170
|
-
compiler.hooks.compilation.tap(pluginName, (compilation) => {
|
|
171
|
-
compilation.hooks.processAssets.tapPromise(
|
|
172
|
-
{
|
|
173
|
-
name: pluginName,
|
|
174
|
-
stage: Compilation.PROCESS_ASSETS_STAGE_SUMMARIZE
|
|
175
|
-
},
|
|
176
|
-
async (assets) => {
|
|
177
|
-
const groupedEntries = getGroupedEntries(Object.entries(assets));
|
|
178
|
-
for (const [id, cssSource] of groupedEntries.css) {
|
|
179
|
-
const { code } = await cssHandler(cssSource.source().toString(), {
|
|
180
|
-
id,
|
|
181
|
-
ctx
|
|
182
|
-
});
|
|
183
|
-
const source = new ConcatSource(code);
|
|
184
|
-
compilation.updateAsset(id, source);
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
);
|
|
188
|
-
});
|
|
189
|
-
},
|
|
190
|
-
writeBundle() {
|
|
191
|
-
ctx.dump();
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
];
|
|
195
|
-
};
|
|
196
|
-
var factory_default = factory;
|
|
197
|
-
|
|
198
|
-
// src/core/plugin.ts
|
|
199
|
-
var unplugin = createUnplugin(factory_default);
|
|
200
|
-
var plugin_default = unplugin;
|
|
201
|
-
|
|
202
|
-
export {
|
|
203
|
-
plugin_default
|
|
204
|
-
};
|
package/dist/chunk-Q7X23R6B.js
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
// ../../node_modules/.pnpm/tsup@8.5.1_jiti@2.6.1_postcss@8.5.8_tsx@4.21.0_typescript@5.9.3_yaml@2.8.3/node_modules/tsup/assets/esm_shims.js
|
|
2
|
-
import path from "path";
|
|
3
|
-
import { fileURLToPath } from "url";
|
|
4
|
-
var getFilename = () => fileURLToPath(import.meta.url);
|
|
5
|
-
var getDirname = () => path.dirname(getFilename());
|
|
6
|
-
var __dirname = /* @__PURE__ */ getDirname();
|
|
7
|
-
|
|
8
|
-
export {
|
|
9
|
-
__dirname
|
|
10
|
-
};
|