unplugin-tailwindcss-mangle 5.0.0 → 5.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/README.md +16 -1
- package/dist/chunk-5TU3BRLY.js +204 -0
- package/dist/chunk-A24OOU3C.cjs +201 -0
- package/dist/{chunk-BZZ6FFT4.cjs → chunk-QGD6AWGR.cjs} +8 -8
- package/dist/{chunk-WVLLWHGJ.js → chunk-TVEX3BIF.js} +8 -8
- package/dist/{chunk-DIT5PI2Q.js → chunk-YMEGC4U6.js} +1 -1
- package/dist/esbuild.cjs +3 -3
- package/dist/esbuild.js +3 -3
- package/dist/index.cjs +3 -3
- package/dist/index.js +3 -3
- package/dist/loader.js +1 -1
- package/dist/nuxt.cjs +4 -4
- package/dist/nuxt.js +3 -3
- package/dist/rollup.cjs +3 -3
- package/dist/rollup.js +3 -3
- package/dist/utils.cjs +2 -2
- package/dist/utils.js +2 -2
- package/dist/vite.cjs +3 -3
- package/dist/vite.js +3 -3
- package/dist/webpack.cjs +3 -3
- package/dist/webpack.js +3 -3
- package/package.json +13 -6
- package/dist/chunk-GVV277P6.js +0 -142
- package/dist/chunk-KXU3DR5D.cjs +0 -139
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@ mangle tailwindcss utilities plugin
|
|
|
4
4
|
|
|
5
5
|
It is recommended to read the documentation of [tailwindcss-patch](https://github.com/sonofmagic/tailwindcss-mangle/tree/main/packages/tailwindcss-patch) first, `unplugin-tailwindcss-mangle` depends on this tool.
|
|
6
6
|
|
|
7
|
-
> Now Support `vite` and `
|
|
7
|
+
> Now Support `vite`, `webpack`, `esbuild`, and `nuxt`
|
|
8
8
|
|
|
9
9
|
- [unplugin-tailwindcss-mangle](#unplugin-tailwindcss-mangle)
|
|
10
10
|
- [Docs](#docs)
|
|
@@ -17,6 +17,7 @@ It is recommended to read the documentation of [tailwindcss-patch](https://githu
|
|
|
17
17
|
- [5. Register this plugin](#5-register-this-plugin)
|
|
18
18
|
- [vite](#vite)
|
|
19
19
|
- [webpack](#webpack)
|
|
20
|
+
- [esbuild](#esbuild)
|
|
20
21
|
- [Nuxt 3](#nuxt-3)
|
|
21
22
|
- [Options](#options)
|
|
22
23
|
- [Notice](#notice)
|
|
@@ -119,6 +120,20 @@ module.exports = defineConfig({
|
|
|
119
120
|
})
|
|
120
121
|
```
|
|
121
122
|
|
|
123
|
+
#### esbuild
|
|
124
|
+
|
|
125
|
+
```js
|
|
126
|
+
import { build } from 'esbuild'
|
|
127
|
+
import utwm from 'unplugin-tailwindcss-mangle/esbuild'
|
|
128
|
+
|
|
129
|
+
await build({
|
|
130
|
+
entryPoints: ['src/main.ts'],
|
|
131
|
+
bundle: true,
|
|
132
|
+
outfile: 'dist/index.js',
|
|
133
|
+
plugins: [utwm()]
|
|
134
|
+
})
|
|
135
|
+
```
|
|
136
|
+
|
|
122
137
|
#### Nuxt 3
|
|
123
138
|
|
|
124
139
|
```ts
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
import {
|
|
2
|
+
getGroupedEntries,
|
|
3
|
+
pluginName,
|
|
4
|
+
posix
|
|
5
|
+
} from "./chunk-TVEX3BIF.js";
|
|
6
|
+
import {
|
|
7
|
+
__dirname
|
|
8
|
+
} from "./chunk-YMEGC4U6.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
|
+
};
|
|
@@ -0,0 +1,201 @@
|
|
|
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;
|
|
@@ -455,17 +455,17 @@ function getGroupedEntries(entries, options = {
|
|
|
455
455
|
return "other";
|
|
456
456
|
}
|
|
457
457
|
});
|
|
458
|
-
if (!groupedEntries
|
|
459
|
-
groupedEntries
|
|
458
|
+
if (!groupedEntries["css"]) {
|
|
459
|
+
groupedEntries["css"] = [];
|
|
460
460
|
}
|
|
461
|
-
if (!groupedEntries
|
|
462
|
-
groupedEntries
|
|
461
|
+
if (!groupedEntries["html"]) {
|
|
462
|
+
groupedEntries["html"] = [];
|
|
463
463
|
}
|
|
464
|
-
if (!groupedEntries
|
|
465
|
-
groupedEntries
|
|
464
|
+
if (!groupedEntries["js"]) {
|
|
465
|
+
groupedEntries["js"] = [];
|
|
466
466
|
}
|
|
467
|
-
if (!groupedEntries
|
|
468
|
-
groupedEntries
|
|
467
|
+
if (!groupedEntries["other"]) {
|
|
468
|
+
groupedEntries["other"] = [];
|
|
469
469
|
}
|
|
470
470
|
return groupedEntries;
|
|
471
471
|
}
|
|
@@ -455,17 +455,17 @@ function getGroupedEntries(entries, options = {
|
|
|
455
455
|
return "other";
|
|
456
456
|
}
|
|
457
457
|
});
|
|
458
|
-
if (!groupedEntries
|
|
459
|
-
groupedEntries
|
|
458
|
+
if (!groupedEntries["css"]) {
|
|
459
|
+
groupedEntries["css"] = [];
|
|
460
460
|
}
|
|
461
|
-
if (!groupedEntries
|
|
462
|
-
groupedEntries
|
|
461
|
+
if (!groupedEntries["html"]) {
|
|
462
|
+
groupedEntries["html"] = [];
|
|
463
463
|
}
|
|
464
|
-
if (!groupedEntries
|
|
465
|
-
groupedEntries
|
|
464
|
+
if (!groupedEntries["js"]) {
|
|
465
|
+
groupedEntries["js"] = [];
|
|
466
466
|
}
|
|
467
|
-
if (!groupedEntries
|
|
468
|
-
groupedEntries
|
|
467
|
+
if (!groupedEntries["other"]) {
|
|
468
|
+
groupedEntries["other"] = [];
|
|
469
469
|
}
|
|
470
470
|
return groupedEntries;
|
|
471
471
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// ../../node_modules/.pnpm/tsup@8.5.
|
|
1
|
+
// ../../node_modules/.pnpm/tsup@8.5.1_jiti@2.6.1_postcss@8.5.6_tsx@4.21.0_typescript@5.9.3_yaml@2.8.2/node_modules/tsup/assets/esm_shims.js
|
|
2
2
|
import path from "path";
|
|
3
3
|
import { fileURLToPath } from "url";
|
|
4
4
|
var getFilename = () => fileURLToPath(import.meta.url);
|
package/dist/esbuild.cjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('./chunk-
|
|
3
|
+
var _chunkA24OOU3Ccjs = require('./chunk-A24OOU3C.cjs');
|
|
4
|
+
require('./chunk-QGD6AWGR.cjs');
|
|
5
5
|
|
|
6
6
|
// src/esbuild.ts
|
|
7
|
-
var esbuild_default =
|
|
7
|
+
var esbuild_default = _chunkA24OOU3Ccjs.plugin_default.esbuild;
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
exports.default = esbuild_default;
|
package/dist/esbuild.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
plugin_default
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
5
|
-
import "./chunk-
|
|
3
|
+
} from "./chunk-5TU3BRLY.js";
|
|
4
|
+
import "./chunk-TVEX3BIF.js";
|
|
5
|
+
import "./chunk-YMEGC4U6.js";
|
|
6
6
|
|
|
7
7
|
// src/esbuild.ts
|
|
8
8
|
var esbuild_default = plugin_default.esbuild;
|
package/dist/index.cjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('./chunk-
|
|
3
|
+
var _chunkA24OOU3Ccjs = require('./chunk-A24OOU3C.cjs');
|
|
4
|
+
require('./chunk-QGD6AWGR.cjs');
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
exports.default =
|
|
7
|
+
exports.default = _chunkA24OOU3Ccjs.plugin_default;
|
|
8
8
|
|
|
9
9
|
module.exports = exports.default;
|
package/dist/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
plugin_default
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
5
|
-
import "./chunk-
|
|
3
|
+
} from "./chunk-5TU3BRLY.js";
|
|
4
|
+
import "./chunk-TVEX3BIF.js";
|
|
5
|
+
import "./chunk-YMEGC4U6.js";
|
|
6
6
|
export {
|
|
7
7
|
plugin_default as default
|
|
8
8
|
};
|
package/dist/loader.js
CHANGED
package/dist/nuxt.cjs
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('./chunk-
|
|
3
|
+
var _chunkA24OOU3Ccjs = require('./chunk-A24OOU3C.cjs');
|
|
4
|
+
require('./chunk-QGD6AWGR.cjs');
|
|
5
5
|
|
|
6
6
|
// src/nuxt.ts
|
|
7
7
|
function nuxt_default(options = {}, nuxt) {
|
|
8
8
|
nuxt.hook("webpack:config", (config) => {
|
|
9
9
|
config.plugins = config.plugins || [];
|
|
10
|
-
config.plugins.unshift(
|
|
10
|
+
config.plugins.unshift(_chunkA24OOU3Ccjs.plugin_default.webpack(options));
|
|
11
11
|
});
|
|
12
12
|
nuxt.hook("vite:extendConfig", (config) => {
|
|
13
13
|
config.plugins = config.plugins || [];
|
|
14
|
-
config.plugins.push(
|
|
14
|
+
config.plugins.push(_chunkA24OOU3Ccjs.plugin_default.vite(options));
|
|
15
15
|
});
|
|
16
16
|
}
|
|
17
17
|
|
package/dist/nuxt.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
plugin_default
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
5
|
-
import "./chunk-
|
|
3
|
+
} from "./chunk-5TU3BRLY.js";
|
|
4
|
+
import "./chunk-TVEX3BIF.js";
|
|
5
|
+
import "./chunk-YMEGC4U6.js";
|
|
6
6
|
|
|
7
7
|
// src/nuxt.ts
|
|
8
8
|
function nuxt_default(options = {}, nuxt) {
|
package/dist/rollup.cjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('./chunk-
|
|
3
|
+
var _chunkA24OOU3Ccjs = require('./chunk-A24OOU3C.cjs');
|
|
4
|
+
require('./chunk-QGD6AWGR.cjs');
|
|
5
5
|
|
|
6
6
|
// src/rollup.ts
|
|
7
|
-
var rollup_default =
|
|
7
|
+
var rollup_default = _chunkA24OOU3Ccjs.plugin_default.rollup;
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
exports.default = rollup_default;
|
package/dist/rollup.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
plugin_default
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
5
|
-
import "./chunk-
|
|
3
|
+
} from "./chunk-5TU3BRLY.js";
|
|
4
|
+
import "./chunk-TVEX3BIF.js";
|
|
5
|
+
import "./chunk-YMEGC4U6.js";
|
|
6
6
|
|
|
7
7
|
// src/rollup.ts
|
|
8
8
|
var rollup_default = plugin_default.rollup;
|
package/dist/utils.cjs
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
var
|
|
9
|
+
var _chunkQGD6AWGRcjs = require('./chunk-QGD6AWGR.cjs');
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
|
|
@@ -15,4 +15,4 @@ var _chunkBZZ6FFT4cjs = require('./chunk-BZZ6FFT4.cjs');
|
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
|
|
18
|
-
exports.defaultMangleClassFilter =
|
|
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;
|
package/dist/utils.js
CHANGED
package/dist/vite.cjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('./chunk-
|
|
3
|
+
var _chunkA24OOU3Ccjs = require('./chunk-A24OOU3C.cjs');
|
|
4
|
+
require('./chunk-QGD6AWGR.cjs');
|
|
5
5
|
|
|
6
6
|
// src/vite.ts
|
|
7
|
-
var vite_default =
|
|
7
|
+
var vite_default = _chunkA24OOU3Ccjs.plugin_default.vite;
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
exports.default = vite_default;
|
package/dist/vite.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
plugin_default
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
5
|
-
import "./chunk-
|
|
3
|
+
} from "./chunk-5TU3BRLY.js";
|
|
4
|
+
import "./chunk-TVEX3BIF.js";
|
|
5
|
+
import "./chunk-YMEGC4U6.js";
|
|
6
6
|
|
|
7
7
|
// src/vite.ts
|
|
8
8
|
var vite_default = plugin_default.vite;
|
package/dist/webpack.cjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('./chunk-
|
|
3
|
+
var _chunkA24OOU3Ccjs = require('./chunk-A24OOU3C.cjs');
|
|
4
|
+
require('./chunk-QGD6AWGR.cjs');
|
|
5
5
|
|
|
6
6
|
// src/webpack.ts
|
|
7
|
-
var webpack_default =
|
|
7
|
+
var webpack_default = _chunkA24OOU3Ccjs.plugin_default.webpack;
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
exports.default = webpack_default;
|
package/dist/webpack.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
plugin_default
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
5
|
-
import "./chunk-
|
|
3
|
+
} from "./chunk-5TU3BRLY.js";
|
|
4
|
+
import "./chunk-TVEX3BIF.js";
|
|
5
|
+
import "./chunk-YMEGC4U6.js";
|
|
6
6
|
|
|
7
7
|
// src/webpack.ts
|
|
8
8
|
var webpack_default = plugin_default.webpack;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "unplugin-tailwindcss-mangle",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "5.
|
|
4
|
+
"version": "5.1.1",
|
|
5
5
|
"description": "mangle tailwindcss utilities class plugin. support vite and webpack!",
|
|
6
6
|
"author": "ice breaker <1324318532@qq.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -48,6 +48,11 @@
|
|
|
48
48
|
"import": "./dist/esbuild.js",
|
|
49
49
|
"require": "./dist/esbuild.cjs"
|
|
50
50
|
},
|
|
51
|
+
"./nuxt": {
|
|
52
|
+
"types": "./dist/nuxt.d.ts",
|
|
53
|
+
"import": "./dist/nuxt.js",
|
|
54
|
+
"require": "./dist/nuxt.cjs"
|
|
55
|
+
},
|
|
51
56
|
"./*": "./*"
|
|
52
57
|
},
|
|
53
58
|
"main": "./dist/index.cjs",
|
|
@@ -68,10 +73,10 @@
|
|
|
68
73
|
"@rollup/pluginutils": "^5.3.0",
|
|
69
74
|
"is-css-request": "^1.0.1",
|
|
70
75
|
"magic-string": "^0.30.21",
|
|
71
|
-
"unplugin": "^
|
|
72
|
-
"@tailwindcss-mangle/config": "^6.
|
|
73
|
-
"@tailwindcss-mangle/
|
|
74
|
-
"@tailwindcss-mangle/
|
|
76
|
+
"unplugin": "^3.0.0",
|
|
77
|
+
"@tailwindcss-mangle/config": "^6.1.2",
|
|
78
|
+
"@tailwindcss-mangle/core": "^5.1.1",
|
|
79
|
+
"@tailwindcss-mangle/shared": "^4.1.2"
|
|
75
80
|
},
|
|
76
81
|
"publishConfig": {
|
|
77
82
|
"access": "public",
|
|
@@ -81,6 +86,8 @@
|
|
|
81
86
|
"dev": "tsup --watch --sourcemap",
|
|
82
87
|
"build": "tsup",
|
|
83
88
|
"test": "vitest run --coverage.enabled",
|
|
84
|
-
"test:dev": "vitest"
|
|
89
|
+
"test:dev": "vitest",
|
|
90
|
+
"test:e2e": "TWM_APPS_E2E=1 vitest run test/apps.e2e.test.ts",
|
|
91
|
+
"test:e2e:pw": "TWM_APPS_E2E_PLAYWRIGHT=1 vitest run test/apps.playwright.e2e.test.ts"
|
|
85
92
|
}
|
|
86
93
|
}
|
package/dist/chunk-GVV277P6.js
DELETED
|
@@ -1,142 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
getGroupedEntries,
|
|
3
|
-
pluginName,
|
|
4
|
-
posix
|
|
5
|
-
} from "./chunk-WVLLWHGJ.js";
|
|
6
|
-
import {
|
|
7
|
-
__dirname
|
|
8
|
-
} from "./chunk-DIT5PI2Q.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 } 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 factory = (options) => {
|
|
19
|
-
const ctx = new Context();
|
|
20
|
-
let filter = (_id) => true;
|
|
21
|
-
return [
|
|
22
|
-
{
|
|
23
|
-
name: `${pluginName}:pre`,
|
|
24
|
-
enforce: "pre",
|
|
25
|
-
async buildStart() {
|
|
26
|
-
await ctx.initConfig({
|
|
27
|
-
transformerOptions: options
|
|
28
|
-
});
|
|
29
|
-
filter = createFilter(ctx.options.sources?.include, ctx.options.sources?.exclude);
|
|
30
|
-
}
|
|
31
|
-
},
|
|
32
|
-
{
|
|
33
|
-
name: `${pluginName}`,
|
|
34
|
-
transformInclude(id) {
|
|
35
|
-
return filter(id);
|
|
36
|
-
},
|
|
37
|
-
async transform(code, id) {
|
|
38
|
-
const opts = {
|
|
39
|
-
ctx,
|
|
40
|
-
id
|
|
41
|
-
};
|
|
42
|
-
if (/\.[jt]sx?(?:$|\?)/.test(id)) {
|
|
43
|
-
return jsHandler(code, opts);
|
|
44
|
-
} else if (/\.(?:vue|svelte)(?:$|\?)/.test(id)) {
|
|
45
|
-
if (isCSSRequest(id)) {
|
|
46
|
-
return await cssHandler(code, opts);
|
|
47
|
-
} else {
|
|
48
|
-
return jsHandler(code, opts);
|
|
49
|
-
}
|
|
50
|
-
} else if (isCSSRequest(id)) {
|
|
51
|
-
return await cssHandler(code, opts);
|
|
52
|
-
} else if (/\.html?/.test(id)) {
|
|
53
|
-
return htmlHandler(code, opts);
|
|
54
|
-
}
|
|
55
|
-
},
|
|
56
|
-
webpack(compiler) {
|
|
57
|
-
const { NormalModule } = compiler.webpack;
|
|
58
|
-
const isExisted = true;
|
|
59
|
-
compiler.hooks.compilation.tap(pluginName, (compilation) => {
|
|
60
|
-
NormalModule.getCompilationHooks(compilation).loader.tap(pluginName, (_loaderContext, module) => {
|
|
61
|
-
if (isExisted) {
|
|
62
|
-
const idx = module.loaders.findIndex((x) => x.loader.includes("postcss-loader"));
|
|
63
|
-
if (idx > -1) {
|
|
64
|
-
module.loaders.splice(idx, 0, {
|
|
65
|
-
loader: WEBPACK_LOADER,
|
|
66
|
-
ident: null,
|
|
67
|
-
options: {
|
|
68
|
-
ctx
|
|
69
|
-
},
|
|
70
|
-
type: null
|
|
71
|
-
});
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
});
|
|
75
|
-
});
|
|
76
|
-
}
|
|
77
|
-
},
|
|
78
|
-
{
|
|
79
|
-
name: `${pluginName}:post`,
|
|
80
|
-
enforce: "post",
|
|
81
|
-
vite: {
|
|
82
|
-
transformIndexHtml(html) {
|
|
83
|
-
const { code } = htmlHandler(html, { ctx });
|
|
84
|
-
return code;
|
|
85
|
-
}
|
|
86
|
-
// generateBundle: {
|
|
87
|
-
// async handler(options, bundle) {
|
|
88
|
-
// const groupedEntries = getGroupedEntries(Object.entries(bundle))
|
|
89
|
-
// if (Array.isArray(groupedEntries.css) && groupedEntries.css.length > 0) {
|
|
90
|
-
// for (let i = 0; i < groupedEntries.css.length; i++) {
|
|
91
|
-
// const [id, cssSource] = groupedEntries.css[i] as [string, OutputAsset]
|
|
92
|
-
// const { code } = await cssHandler(cssSource.source.toString(), {
|
|
93
|
-
// id,
|
|
94
|
-
// ctx,
|
|
95
|
-
// })
|
|
96
|
-
// cssSource.source = code
|
|
97
|
-
// }
|
|
98
|
-
// }
|
|
99
|
-
// },
|
|
100
|
-
// },
|
|
101
|
-
},
|
|
102
|
-
webpack(compiler) {
|
|
103
|
-
const { Compilation, sources } = compiler.webpack;
|
|
104
|
-
const { ConcatSource } = sources;
|
|
105
|
-
compiler.hooks.compilation.tap(pluginName, (compilation) => {
|
|
106
|
-
compilation.hooks.processAssets.tapPromise(
|
|
107
|
-
{
|
|
108
|
-
name: pluginName,
|
|
109
|
-
stage: Compilation.PROCESS_ASSETS_STAGE_SUMMARIZE
|
|
110
|
-
},
|
|
111
|
-
async (assets) => {
|
|
112
|
-
const groupedEntries = getGroupedEntries(Object.entries(assets));
|
|
113
|
-
if (groupedEntries.css.length > 0) {
|
|
114
|
-
for (let i = 0; i < groupedEntries.css.length; i++) {
|
|
115
|
-
const [id, cssSource] = groupedEntries.css[i];
|
|
116
|
-
const { code } = await cssHandler(cssSource.source().toString(), {
|
|
117
|
-
id,
|
|
118
|
-
ctx
|
|
119
|
-
});
|
|
120
|
-
const source = new ConcatSource(code);
|
|
121
|
-
compilation.updateAsset(id, source);
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
);
|
|
126
|
-
});
|
|
127
|
-
},
|
|
128
|
-
writeBundle() {
|
|
129
|
-
ctx.dump();
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
];
|
|
133
|
-
};
|
|
134
|
-
var factory_default = factory;
|
|
135
|
-
|
|
136
|
-
// src/core/plugin.ts
|
|
137
|
-
var unplugin = createUnplugin(factory_default);
|
|
138
|
-
var plugin_default = unplugin;
|
|
139
|
-
|
|
140
|
-
export {
|
|
141
|
-
plugin_default
|
|
142
|
-
};
|
package/dist/chunk-KXU3DR5D.cjs
DELETED
|
@@ -1,139 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); 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 _chunkBZZ6FFT4cjs = require('./chunk-BZZ6FFT4.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 = _chunkBZZ6FFT4cjs.posix.resolve(__dirname, false ? "../../dist/loader.cjs" : "./loader.cjs");
|
|
15
|
-
var factory = (options) => {
|
|
16
|
-
const ctx = new (0, _core.Context)();
|
|
17
|
-
let filter = (_id) => true;
|
|
18
|
-
return [
|
|
19
|
-
{
|
|
20
|
-
name: `${_chunkBZZ6FFT4cjs.pluginName}:pre`,
|
|
21
|
-
enforce: "pre",
|
|
22
|
-
async buildStart() {
|
|
23
|
-
await ctx.initConfig({
|
|
24
|
-
transformerOptions: options
|
|
25
|
-
});
|
|
26
|
-
filter = _pluginutils.createFilter.call(void 0, _optionalChain([ctx, 'access', _ => _.options, 'access', _2 => _2.sources, 'optionalAccess', _3 => _3.include]), _optionalChain([ctx, 'access', _4 => _4.options, 'access', _5 => _5.sources, 'optionalAccess', _6 => _6.exclude]));
|
|
27
|
-
}
|
|
28
|
-
},
|
|
29
|
-
{
|
|
30
|
-
name: `${_chunkBZZ6FFT4cjs.pluginName}`,
|
|
31
|
-
transformInclude(id) {
|
|
32
|
-
return filter(id);
|
|
33
|
-
},
|
|
34
|
-
async transform(code, id) {
|
|
35
|
-
const opts = {
|
|
36
|
-
ctx,
|
|
37
|
-
id
|
|
38
|
-
};
|
|
39
|
-
if (/\.[jt]sx?(?:$|\?)/.test(id)) {
|
|
40
|
-
return _core.jsHandler.call(void 0, code, opts);
|
|
41
|
-
} else if (/\.(?:vue|svelte)(?:$|\?)/.test(id)) {
|
|
42
|
-
if (_iscssrequest.isCSSRequest.call(void 0, id)) {
|
|
43
|
-
return await _core.cssHandler.call(void 0, code, opts);
|
|
44
|
-
} else {
|
|
45
|
-
return _core.jsHandler.call(void 0, code, opts);
|
|
46
|
-
}
|
|
47
|
-
} else if (_iscssrequest.isCSSRequest.call(void 0, id)) {
|
|
48
|
-
return await _core.cssHandler.call(void 0, code, opts);
|
|
49
|
-
} else if (/\.html?/.test(id)) {
|
|
50
|
-
return _core.htmlHandler.call(void 0, code, opts);
|
|
51
|
-
}
|
|
52
|
-
},
|
|
53
|
-
webpack(compiler) {
|
|
54
|
-
const { NormalModule } = compiler.webpack;
|
|
55
|
-
const isExisted = true;
|
|
56
|
-
compiler.hooks.compilation.tap(_chunkBZZ6FFT4cjs.pluginName, (compilation) => {
|
|
57
|
-
NormalModule.getCompilationHooks(compilation).loader.tap(_chunkBZZ6FFT4cjs.pluginName, (_loaderContext, module) => {
|
|
58
|
-
if (isExisted) {
|
|
59
|
-
const idx = module.loaders.findIndex((x) => x.loader.includes("postcss-loader"));
|
|
60
|
-
if (idx > -1) {
|
|
61
|
-
module.loaders.splice(idx, 0, {
|
|
62
|
-
loader: WEBPACK_LOADER,
|
|
63
|
-
ident: null,
|
|
64
|
-
options: {
|
|
65
|
-
ctx
|
|
66
|
-
},
|
|
67
|
-
type: null
|
|
68
|
-
});
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
});
|
|
72
|
-
});
|
|
73
|
-
}
|
|
74
|
-
},
|
|
75
|
-
{
|
|
76
|
-
name: `${_chunkBZZ6FFT4cjs.pluginName}:post`,
|
|
77
|
-
enforce: "post",
|
|
78
|
-
vite: {
|
|
79
|
-
transformIndexHtml(html) {
|
|
80
|
-
const { code } = _core.htmlHandler.call(void 0, html, { ctx });
|
|
81
|
-
return code;
|
|
82
|
-
}
|
|
83
|
-
// generateBundle: {
|
|
84
|
-
// async handler(options, bundle) {
|
|
85
|
-
// const groupedEntries = getGroupedEntries(Object.entries(bundle))
|
|
86
|
-
// if (Array.isArray(groupedEntries.css) && groupedEntries.css.length > 0) {
|
|
87
|
-
// for (let i = 0; i < groupedEntries.css.length; i++) {
|
|
88
|
-
// const [id, cssSource] = groupedEntries.css[i] as [string, OutputAsset]
|
|
89
|
-
// const { code } = await cssHandler(cssSource.source.toString(), {
|
|
90
|
-
// id,
|
|
91
|
-
// ctx,
|
|
92
|
-
// })
|
|
93
|
-
// cssSource.source = code
|
|
94
|
-
// }
|
|
95
|
-
// }
|
|
96
|
-
// },
|
|
97
|
-
// },
|
|
98
|
-
},
|
|
99
|
-
webpack(compiler) {
|
|
100
|
-
const { Compilation, sources } = compiler.webpack;
|
|
101
|
-
const { ConcatSource } = sources;
|
|
102
|
-
compiler.hooks.compilation.tap(_chunkBZZ6FFT4cjs.pluginName, (compilation) => {
|
|
103
|
-
compilation.hooks.processAssets.tapPromise(
|
|
104
|
-
{
|
|
105
|
-
name: _chunkBZZ6FFT4cjs.pluginName,
|
|
106
|
-
stage: Compilation.PROCESS_ASSETS_STAGE_SUMMARIZE
|
|
107
|
-
},
|
|
108
|
-
async (assets) => {
|
|
109
|
-
const groupedEntries = _chunkBZZ6FFT4cjs.getGroupedEntries.call(void 0, Object.entries(assets));
|
|
110
|
-
if (groupedEntries.css.length > 0) {
|
|
111
|
-
for (let i = 0; i < groupedEntries.css.length; i++) {
|
|
112
|
-
const [id, cssSource] = groupedEntries.css[i];
|
|
113
|
-
const { code } = await _core.cssHandler.call(void 0, cssSource.source().toString(), {
|
|
114
|
-
id,
|
|
115
|
-
ctx
|
|
116
|
-
});
|
|
117
|
-
const source = new ConcatSource(code);
|
|
118
|
-
compilation.updateAsset(id, source);
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
);
|
|
123
|
-
});
|
|
124
|
-
},
|
|
125
|
-
writeBundle() {
|
|
126
|
-
ctx.dump();
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
];
|
|
130
|
-
};
|
|
131
|
-
var factory_default = factory;
|
|
132
|
-
|
|
133
|
-
// src/core/plugin.ts
|
|
134
|
-
var unplugin = _unplugin.createUnplugin.call(void 0, factory_default);
|
|
135
|
-
var plugin_default = unplugin;
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
exports.plugin_default = plugin_default;
|