unplugin-tailwindcss-mangle 5.1.3 → 6.0.0

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.
@@ -1,4 +1,4 @@
1
- import { a as getGroupedEntries, c as pluginName } from "./utils-CT4s62m9.js";
1
+ import { a as getGroupedEntries, c as pluginName } from "./utils-Q_tk8olP.js";
2
2
  import path from "node:path";
3
3
  import { fileURLToPath } from "node:url";
4
4
  import { createFilter } from "@rollup/pluginutils";
@@ -6,13 +6,13 @@ import { Context, cssHandler, htmlHandler, jsHandler, svelteHandler, vueHandler
6
6
  import { isCSSRequest } from "is-css-request";
7
7
  import path$1 from "pathe";
8
8
  import { createUnplugin } from "unplugin";
9
- //#region ../../node_modules/.pnpm/tsdown@0.21.10_synckit@0.11.12_typescript@6.0.3/node_modules/tsdown/esm-shims.js
9
+ //#region ../../node_modules/.pnpm/tsdown@0.22.3_tsx@4.22.4_typescript@6.0.3_unrun@0.2.37_synckit@0.11.13_/node_modules/tsdown/esm-shims.js
10
10
  const getFilename = () => fileURLToPath(import.meta.url);
11
11
  const getDirname = () => path.dirname(getFilename());
12
12
  const __dirname = /* @__PURE__ */ getDirname();
13
13
  //#endregion
14
14
  //#region src/core/factory.ts
15
- const WEBPACK_LOADER = path$1.resolve(__dirname, "./loader.cjs");
15
+ const WEBPACK_LOADER = path$1.resolve(__dirname, "./loader.js");
16
16
  const JS_LIKE_EXTENSIONS = new Set([
17
17
  ".js",
18
18
  ".cjs",
package/dist/esbuild.d.ts CHANGED
@@ -1,7 +1,4 @@
1
- import * as _$_tailwindcss_mangle_config0 from "@tailwindcss-mangle/config";
2
- import * as _$esbuild from "esbuild";
3
-
4
1
  //#region src/esbuild.d.ts
5
- declare const _default: (options?: _$_tailwindcss_mangle_config0.TransformerOptions | undefined) => _$esbuild.Plugin;
2
+ declare const _default: (options?: import("@tailwindcss-mangle/config").TransformerOptions | undefined) => import("unplugin").EsbuildPlugin;
6
3
  //#endregion
7
4
  export { _default as default };
package/dist/esbuild.js CHANGED
@@ -1,4 +1,4 @@
1
- import { t as unplugin } from "./core-ClSeSCtC.js";
1
+ import { t as unplugin } from "./core-k7kIZDw9.js";
2
2
  //#region src/esbuild.ts
3
3
  var esbuild_default = unplugin.esbuild;
4
4
  //#endregion
package/dist/index.d.ts CHANGED
@@ -1,7 +1,4 @@
1
- import * as _$unplugin from "unplugin";
2
- import * as _$_tailwindcss_mangle_config0 from "@tailwindcss-mangle/config";
3
-
4
1
  //#region src/core/plugin.d.ts
5
- declare const unplugin: _$unplugin.UnpluginInstance<_$_tailwindcss_mangle_config0.TransformerOptions | undefined, boolean>;
2
+ declare const unplugin: import("unplugin").UnpluginInstance<import("@tailwindcss-mangle/config").TransformerOptions | undefined, boolean>;
6
3
  //#endregion
7
4
  export { unplugin as default };
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- import { t as unplugin } from "./core-ClSeSCtC.js";
1
+ import { t as unplugin } from "./core-k7kIZDw9.js";
2
2
  export { unplugin as default };
package/dist/nuxt.js CHANGED
@@ -1,4 +1,4 @@
1
- import { t as unplugin } from "./core-ClSeSCtC.js";
1
+ import { t as unplugin } from "./core-k7kIZDw9.js";
2
2
  //#region src/nuxt.ts
3
3
  function nuxt_default(options = {}, nuxt) {
4
4
  nuxt.hook("webpack:config", (config) => {
package/dist/rollup.d.ts CHANGED
@@ -1,7 +1,4 @@
1
- import * as _$_tailwindcss_mangle_config0 from "@tailwindcss-mangle/config";
2
- import * as _$rollup from "rollup";
3
-
4
1
  //#region src/rollup.d.ts
5
- declare const _default: (options?: _$_tailwindcss_mangle_config0.TransformerOptions | undefined) => _$rollup.Plugin<any> | _$rollup.Plugin<any>[];
2
+ declare const _default: (options?: import("@tailwindcss-mangle/config").TransformerOptions | undefined) => import("unplugin").RollupPlugin<any> | import("unplugin").RollupPlugin<any>[];
6
3
  //#endregion
7
4
  export { _default as default };
package/dist/rollup.js CHANGED
@@ -1,4 +1,4 @@
1
- import { t as unplugin } from "./core-ClSeSCtC.js";
1
+ import { t as unplugin } from "./core-k7kIZDw9.js";
2
2
  //#region src/rollup.ts
3
3
  var rollup_default = unplugin.rollup;
4
4
  //#endregion
package/dist/utils.js CHANGED
@@ -1,2 +1,2 @@
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";
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
2
  export { defaultMangleClassFilter, ensureDir, escapeStringRegexp, getCacheDir, getGroupedEntries, isMap, isRegexp };
package/dist/vite.d.ts CHANGED
@@ -1,7 +1,4 @@
1
- import * as _$_tailwindcss_mangle_config0 from "@tailwindcss-mangle/config";
2
- import * as _$vite from "vite";
3
-
4
1
  //#region src/vite.d.ts
5
- declare const _default: (options?: _$_tailwindcss_mangle_config0.TransformerOptions | undefined) => _$vite.Plugin<any> | _$vite.Plugin<any>[];
2
+ declare const _default: (options?: import("@tailwindcss-mangle/config").TransformerOptions | undefined) => import("unplugin").VitePlugin<any> | import("unplugin").VitePlugin<any>[];
6
3
  //#endregion
7
4
  export { _default as default };
package/dist/vite.js CHANGED
@@ -1,4 +1,4 @@
1
- import { t as unplugin } from "./core-ClSeSCtC.js";
1
+ import { t as unplugin } from "./core-k7kIZDw9.js";
2
2
  //#region src/vite.ts
3
3
  var vite_default = unplugin.vite;
4
4
  //#endregion
package/dist/webpack.d.ts CHANGED
@@ -1,7 +1,4 @@
1
- import * as _$_tailwindcss_mangle_config0 from "@tailwindcss-mangle/config";
2
- import * as _$webpack from "webpack";
3
-
4
1
  //#region src/webpack.d.ts
5
- declare const _default: (options?: _$_tailwindcss_mangle_config0.TransformerOptions | undefined) => _$webpack.WebpackPluginInstance;
2
+ declare const _default: (options?: import("@tailwindcss-mangle/config").TransformerOptions | undefined) => import("webpack").WebpackPluginInstance;
6
3
  //#endregion
7
4
  export { _default as default };
package/dist/webpack.js CHANGED
@@ -1,4 +1,4 @@
1
- import { t as unplugin } from "./core-ClSeSCtC.js";
1
+ import { t as unplugin } from "./core-k7kIZDw9.js";
2
2
  //#region src/webpack.ts
3
3
  var webpack_default = unplugin.webpack;
4
4
  //#endregion
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "unplugin-tailwindcss-mangle",
3
3
  "type": "module",
4
- "version": "5.1.3",
4
+ "version": "6.0.0",
5
5
  "description": "mangle tailwindcss utilities class plugin. support vite and webpack!",
6
6
  "author": "ice breaker <1324318532@qq.com>",
7
7
  "license": "MIT",
@@ -26,36 +26,36 @@
26
26
  ".": {
27
27
  "types": "./dist/index.d.ts",
28
28
  "import": "./dist/index.js",
29
- "require": "./dist/index.cjs"
29
+ "default": "./dist/index.js"
30
30
  },
31
31
  "./vite": {
32
32
  "types": "./dist/vite.d.ts",
33
33
  "import": "./dist/vite.js",
34
- "require": "./dist/vite.cjs"
34
+ "default": "./dist/vite.js"
35
35
  },
36
36
  "./webpack": {
37
37
  "types": "./dist/webpack.d.ts",
38
38
  "import": "./dist/webpack.js",
39
- "require": "./dist/webpack.cjs"
39
+ "default": "./dist/webpack.js"
40
40
  },
41
41
  "./rollup": {
42
42
  "types": "./dist/rollup.d.ts",
43
43
  "import": "./dist/rollup.js",
44
- "require": "./dist/rollup.cjs"
44
+ "default": "./dist/rollup.js"
45
45
  },
46
46
  "./esbuild": {
47
47
  "types": "./dist/esbuild.d.ts",
48
48
  "import": "./dist/esbuild.js",
49
- "require": "./dist/esbuild.cjs"
49
+ "default": "./dist/esbuild.js"
50
50
  },
51
51
  "./nuxt": {
52
52
  "types": "./dist/nuxt.d.ts",
53
53
  "import": "./dist/nuxt.js",
54
- "require": "./dist/nuxt.cjs"
54
+ "default": "./dist/nuxt.js"
55
55
  },
56
56
  "./*": "./*"
57
57
  },
58
- "main": "./dist/index.cjs",
58
+ "main": "./dist/index.js",
59
59
  "module": "./dist/index.js",
60
60
  "types": "./dist/index.d.ts",
61
61
  "typesVersions": {
@@ -70,18 +70,21 @@
70
70
  "dist"
71
71
  ],
72
72
  "dependencies": {
73
- "@rollup/pluginutils": "^5.3.0",
73
+ "@rollup/pluginutils": "^5.4.0",
74
74
  "is-css-request": "^1.0.1",
75
75
  "magic-string": "^0.30.21",
76
- "unplugin": "^3.0.0",
77
- "@tailwindcss-mangle/config": "^7.0.1",
78
- "@tailwindcss-mangle/core": "^5.1.3",
79
- "@tailwindcss-mangle/shared": "^4.1.5"
76
+ "unplugin": "^3.3.0",
77
+ "@tailwindcss-mangle/config": "^8.0.0",
78
+ "@tailwindcss-mangle/core": "^6.0.0",
79
+ "@tailwindcss-mangle/shared": "^5.0.0"
80
80
  },
81
81
  "publishConfig": {
82
82
  "access": "public",
83
83
  "registry": "https://registry.npmjs.org/"
84
84
  },
85
+ "engines": {
86
+ "node": ">=22.18.0"
87
+ },
85
88
  "scripts": {
86
89
  "dev": "tsdown --watch --sourcemap",
87
90
  "build": "tsdown",
@@ -1,176 +0,0 @@
1
- const require_utils = require("./utils-DnTj6vm7.cjs");
2
- let _rollup_pluginutils = require("@rollup/pluginutils");
3
- let _tailwindcss_mangle_core = require("@tailwindcss-mangle/core");
4
- let is_css_request = require("is-css-request");
5
- let pathe = require("pathe");
6
- pathe = require_utils.__toESM(pathe, 1);
7
- let unplugin = require("unplugin");
8
- //#region src/core/factory.ts
9
- const WEBPACK_LOADER = pathe.default.resolve(__dirname, "./loader.cjs");
10
- const JS_LIKE_EXTENSIONS = new Set([
11
- ".js",
12
- ".cjs",
13
- ".mjs",
14
- ".ts",
15
- ".cts",
16
- ".mts",
17
- ".jsx",
18
- ".tsx"
19
- ]);
20
- const HTML_LIKE_EXTENSIONS = new Set([".html", ".htm"]);
21
- const CSS_LIKE_LANGS = new Set([
22
- "css",
23
- "less",
24
- "sass",
25
- "scss",
26
- "styl",
27
- "stylus",
28
- "pcss",
29
- "postcss",
30
- "sss"
31
- ]);
32
- const JS_LIKE_LANGS = new Set([
33
- "js",
34
- "cjs",
35
- "mjs",
36
- "ts",
37
- "cts",
38
- "mts",
39
- "jsx",
40
- "tsx"
41
- ]);
42
- const HTML_LIKE_LANGS = new Set(["html", "htm"]);
43
- function normalizeLang(rawLang) {
44
- if (!rawLang) return "";
45
- return rawLang.toLowerCase().replace(/^\./, "");
46
- }
47
- function isLikelyMarkup(code) {
48
- return /<[a-z][\w:-]*(?:\s|>)/i.test(code);
49
- }
50
- function isHtmlFileRequest(id) {
51
- const cleanId = id.split("?")[0] ?? id;
52
- const ext = pathe.default.extname(cleanId).toLowerCase();
53
- return HTML_LIKE_EXTENSIONS.has(ext);
54
- }
55
- function resolveTransformKind(id, code) {
56
- if ((0, is_css_request.isCSSRequest)(id)) return "css";
57
- const cleanId = id.split("?")[0] ?? id;
58
- const ext = pathe.default.extname(cleanId).toLowerCase();
59
- const query = id.includes("?") ? id.slice(id.indexOf("?") + 1) : "";
60
- const params = new URLSearchParams(query);
61
- const type = params.get("type")?.toLowerCase();
62
- const lang = normalizeLang(params.get("lang"));
63
- if (type === "style") return "css";
64
- if (type === "script") return "js";
65
- if (type === "template") {
66
- if (lang && JS_LIKE_LANGS.has(lang)) return "js";
67
- if (lang && HTML_LIKE_LANGS.has(lang)) return "html";
68
- return isLikelyMarkup(code) ? "html" : "js";
69
- }
70
- if (lang) {
71
- if (CSS_LIKE_LANGS.has(lang)) return "css";
72
- if (JS_LIKE_LANGS.has(lang)) return "js";
73
- if (HTML_LIKE_LANGS.has(lang)) return "html";
74
- if (lang === "vue") return "vue";
75
- if (lang === "svelte") return "svelte";
76
- }
77
- if (ext === ".vue") return "vue";
78
- if (ext === ".svelte") return "svelte";
79
- if (HTML_LIKE_EXTENSIONS.has(ext)) return "html";
80
- if (JS_LIKE_EXTENSIONS.has(ext)) return "js";
81
- return isLikelyMarkup(code) ? "html" : "js";
82
- }
83
- const factory = (options) => {
84
- const ctx = new _tailwindcss_mangle_core.Context();
85
- let filter = (0, _rollup_pluginutils.createFilter)(options?.sources?.include, options?.sources?.exclude);
86
- return [
87
- {
88
- name: `${require_utils.pluginName}:pre`,
89
- enforce: "pre",
90
- async buildStart() {
91
- const initOptions = options === void 0 ? {} : { transformerOptions: options };
92
- await ctx.initConfig(initOptions);
93
- filter = (0, _rollup_pluginutils.createFilter)(ctx.options.sources?.include, ctx.options.sources?.exclude);
94
- }
95
- },
96
- {
97
- name: `${require_utils.pluginName}`,
98
- transformInclude(id) {
99
- const cleanId = id.split("?")[0] ?? id;
100
- if (isHtmlFileRequest(cleanId)) return false;
101
- return filter(cleanId);
102
- },
103
- async transform(code, id) {
104
- const opts = {
105
- ctx,
106
- id
107
- };
108
- const kind = resolveTransformKind(id, code);
109
- const framework = this.getNativeBuildContext?.().framework;
110
- if ((framework === "webpack" || framework === "rspack") && kind === "html" && isHtmlFileRequest(id)) return null;
111
- switch (kind) {
112
- case "css": return await (0, _tailwindcss_mangle_core.cssHandler)(code, opts);
113
- case "vue": return await (0, _tailwindcss_mangle_core.vueHandler)(code, opts);
114
- case "svelte": return await (0, _tailwindcss_mangle_core.svelteHandler)(code, opts);
115
- case "html": return (0, _tailwindcss_mangle_core.htmlHandler)(code, opts);
116
- default: return (0, _tailwindcss_mangle_core.jsHandler)(code, opts);
117
- }
118
- },
119
- webpack(compiler) {
120
- const { NormalModule } = compiler.webpack;
121
- compiler.hooks.compilation.tap(require_utils.pluginName, (compilation) => {
122
- NormalModule.getCompilationHooks(compilation).loader.tap(require_utils.pluginName, (_loaderContext, module) => {
123
- const idx = module.loaders.findIndex((x) => x.loader.includes("postcss-loader"));
124
- if (idx > -1) module.loaders.splice(idx, 0, {
125
- loader: WEBPACK_LOADER,
126
- ident: null,
127
- options: { ctx },
128
- type: null
129
- });
130
- });
131
- });
132
- }
133
- },
134
- {
135
- name: `${require_utils.pluginName}:post`,
136
- enforce: "post",
137
- vite: { transformIndexHtml(html) {
138
- const { code } = (0, _tailwindcss_mangle_core.htmlHandler)(html, { ctx });
139
- return code;
140
- } },
141
- webpack(compiler) {
142
- const { Compilation, sources } = compiler.webpack;
143
- const { ConcatSource } = sources;
144
- compiler.hooks.compilation.tap(require_utils.pluginName, (compilation) => {
145
- compilation.hooks.processAssets.tapPromise({
146
- name: require_utils.pluginName,
147
- stage: Compilation.PROCESS_ASSETS_STAGE_SUMMARIZE
148
- }, async (assets) => {
149
- const groupedEntries = require_utils.getGroupedEntries(Object.entries(assets));
150
- for (const [id, cssSource] of groupedEntries.css) {
151
- const { code } = await (0, _tailwindcss_mangle_core.cssHandler)(cssSource.source().toString(), {
152
- id,
153
- ctx
154
- });
155
- const source = new ConcatSource(code);
156
- compilation.updateAsset(id, source);
157
- }
158
- });
159
- });
160
- },
161
- writeBundle() {
162
- ctx.dump();
163
- }
164
- }
165
- ];
166
- };
167
- //#endregion
168
- //#region src/core/plugin.ts
169
- const unplugin$1 = (0, unplugin.createUnplugin)(factory);
170
- //#endregion
171
- Object.defineProperty(exports, "unplugin", {
172
- enumerable: true,
173
- get: function() {
174
- return unplugin$1;
175
- }
176
- });
package/dist/esbuild.cjs DELETED
@@ -1,4 +0,0 @@
1
- //#region src/esbuild.ts
2
- var esbuild_default = require("./core-C8BPj6VA.cjs").unplugin.esbuild;
3
- //#endregion
4
- module.exports = esbuild_default;
@@ -1,6 +0,0 @@
1
- import * as _$_tailwindcss_mangle_config0 from "@tailwindcss-mangle/config";
2
- import * as _$esbuild from "esbuild";
3
-
4
- //#region src/esbuild.d.ts
5
- declare const _default: (options?: _$_tailwindcss_mangle_config0.TransformerOptions | undefined) => _$esbuild.Plugin;
6
- export = _default;
package/dist/index.cjs DELETED
@@ -1,2 +0,0 @@
1
- const require_core = require("./core-C8BPj6VA.cjs");
2
- module.exports = require_core.unplugin;
package/dist/index.d.cts DELETED
@@ -1,6 +0,0 @@
1
- import * as _$_tailwindcss_mangle_config0 from "@tailwindcss-mangle/config";
2
- import * as _$unplugin from "unplugin";
3
-
4
- //#region src/core/plugin.d.ts
5
- declare const unplugin: _$unplugin.UnpluginInstance<_$_tailwindcss_mangle_config0.TransformerOptions | undefined, boolean>;
6
- export = unplugin;
package/dist/loader.cjs DELETED
@@ -1,14 +0,0 @@
1
- require("./utils-DnTj6vm7.cjs");
2
- let _tailwindcss_mangle_core = require("@tailwindcss-mangle/core");
3
- //#region src/loader.ts
4
- async function TailwindcssMangleWebpackLoader(source) {
5
- const callback = this.async();
6
- const { ctx } = this.getOptions();
7
- const { code } = await (0, _tailwindcss_mangle_core.cssHandler)(source, {
8
- ctx,
9
- id: this.resource
10
- });
11
- callback(null, code);
12
- }
13
- //#endregion
14
- module.exports = TailwindcssMangleWebpackLoader;
package/dist/loader.d.cts DELETED
@@ -1,8 +0,0 @@
1
- import { Context } from "@tailwindcss-mangle/core";
2
- import { LoaderContext } from "webpack";
3
-
4
- //#region src/loader.d.ts
5
- declare function TailwindcssMangleWebpackLoader(this: LoaderContext<{
6
- ctx: Context;
7
- }>, source: string): Promise<void>;
8
- export = TailwindcssMangleWebpackLoader;
package/dist/nuxt.cjs DELETED
@@ -1,14 +0,0 @@
1
- const require_core = require("./core-C8BPj6VA.cjs");
2
- //#region src/nuxt.ts
3
- function nuxt_default(options = {}, nuxt) {
4
- nuxt.hook("webpack:config", (config) => {
5
- config.plugins = config.plugins || [];
6
- config.plugins.unshift(require_core.unplugin.webpack(options));
7
- });
8
- nuxt.hook("vite:extendConfig", (config) => {
9
- config.plugins = config.plugins || [];
10
- config.plugins.push(require_core.unplugin.vite(options));
11
- });
12
- }
13
- //#endregion
14
- module.exports = nuxt_default;
package/dist/nuxt.d.cts DELETED
@@ -1,5 +0,0 @@
1
- import * as import__tailwindcss_mangle_config from "@tailwindcss-mangle/config";
2
- //#endregion
3
- //#region src/nuxt.d.ts
4
- declare function export_default(options: types_d_exports.TransformerOptions | undefined, nuxt: any): void;
5
- export = export_default;
package/dist/rollup.cjs DELETED
@@ -1,4 +0,0 @@
1
- //#region src/rollup.ts
2
- var rollup_default = require("./core-C8BPj6VA.cjs").unplugin.rollup;
3
- //#endregion
4
- module.exports = rollup_default;
package/dist/rollup.d.cts DELETED
@@ -1,6 +0,0 @@
1
- import * as _$_tailwindcss_mangle_config0 from "@tailwindcss-mangle/config";
2
- import * as _$rollup from "rollup";
3
-
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;
@@ -1,108 +0,0 @@
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 DELETED
@@ -1,25 +0,0 @@
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 DELETED
@@ -1,13 +0,0 @@
1
- import { defaultMangleClassFilter, isMap, isRegexp } from "@tailwindcss-mangle/shared";
2
-
3
- //#region src/utils.d.ts
4
- declare function escapeStringRegexp(str: string): string;
5
- declare function getGroupedEntries<T>(entries: [string, T][], options?: {
6
- cssMatcher(file: string): boolean;
7
- htmlMatcher(file: string): boolean;
8
- jsMatcher(file: string): boolean;
9
- }): Record<"css" | "html" | "js" | "other", [string, T][]>;
10
- declare function getCacheDir(basedir?: string): string;
11
- declare function ensureDir(p: string): Promise<void>;
12
- //#endregion
13
- export { defaultMangleClassFilter, ensureDir, escapeStringRegexp, getCacheDir, getGroupedEntries, isMap, isRegexp };
package/dist/vite.cjs DELETED
@@ -1,4 +0,0 @@
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 DELETED
@@ -1,6 +0,0 @@
1
- import * as _$_tailwindcss_mangle_config0 from "@tailwindcss-mangle/config";
2
- import * as _$vite from "vite";
3
-
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/webpack.cjs DELETED
@@ -1,4 +0,0 @@
1
- //#region src/webpack.ts
2
- var webpack_default = require("./core-C8BPj6VA.cjs").unplugin.webpack;
3
- //#endregion
4
- module.exports = webpack_default;
@@ -1,6 +0,0 @@
1
- import * as _$_tailwindcss_mangle_config0 from "@tailwindcss-mangle/config";
2
- import * as _$webpack from "webpack";
3
-
4
- //#region src/webpack.d.ts
5
- declare const _default: (options?: _$_tailwindcss_mangle_config0.TransformerOptions | undefined) => _$webpack.WebpackPluginInstance;
6
- export = _default;
File without changes