unplugin-tailwindcss-mangle 3.0.0 → 4.0.0-alpha.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.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 ice breaker
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -54,7 +54,7 @@ npx tw-patch install
54
54
 
55
55
  ### 4. Run extract command
56
56
 
57
- cd to the same directory as `package.son` and `tailwind.config.js`, then run:
57
+ cd to the same directory as `package.json` and `tailwind.config.js`, then run:
58
58
 
59
59
  ```sh
60
60
  npx tw-patch extract
@@ -62,17 +62,17 @@ npx tw-patch extract
62
62
 
63
63
  > See more options in [tailwindcss-patch](https://github.com/sonofmagic/tailwindcss-mangle/tree/main/packages/tailwindcss-patch)
64
64
 
65
- Then there will generate a json file: `.tw-patch/tw-class-list.json`
65
+ Then there will generate a json file: `.tw-patch/tw-class-list.json`
66
66
 
67
67
  ### 5. Register this plugin
68
68
 
69
69
  #### vite
70
70
 
71
71
  ```js
72
- // for example: vue vite project
73
- import { defineConfig } from 'vite'
74
72
  import vue from '@vitejs/plugin-vue'
75
73
  import utwm from 'unplugin-tailwindcss-mangle/vite'
74
+ // for example: vue vite project
75
+ import { defineConfig } from 'vite'
76
76
  // https://vitejs.dev/config/
77
77
  export default defineConfig({
78
78
  plugins: [vue(), utwm()]
@@ -117,7 +117,7 @@ module.exports = defineConfig({
117
117
  ```ts
118
118
  import nuxtPlugin from 'unplugin-tailwindcss-mangle/nuxt'
119
119
  export default defineNuxtConfig({
120
- //...
120
+ // ...
121
121
  // https://github.com/nuxt/nuxt/issues/20428
122
122
  // you must set this option to false to enable vite extract css
123
123
  experimental: {
@@ -132,12 +132,11 @@ export default defineNuxtConfig({
132
132
  ]
133
133
  ]
134
134
  })
135
-
136
135
  ```
137
136
 
138
137
  ## Options
139
138
 
140
- [types.ts]('./src/types.ts')
139
+ [types.ts](src/types.ts)
141
140
 
142
141
  ## Notice
143
142
 
@@ -150,7 +149,7 @@ because plugin will **traverse** all `html class attr` and `js StringLiteral` to
150
149
  it's dangerous to mangle some `js StringLiteral` like:
151
150
 
152
151
  ```js
153
- const innerHTML = "i'm flex and relative and grid"
152
+ const innerHTML = 'i\'m flex and relative and grid'
154
153
  document.body.innerHTML = innerHTML
155
154
  ```
156
155
 
package/package.json CHANGED
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "name": "unplugin-tailwindcss-mangle",
3
- "version": "3.0.0",
3
+ "type": "module",
4
+ "version": "4.0.0-alpha.0",
4
5
  "description": "mangle tailwindcss utilities class plugin. support vite and webpack!",
5
6
  "author": "SonOfMagic <qq1324318532@gmail.com>",
6
7
  "license": "MIT",
@@ -20,43 +21,33 @@
20
21
  "exports": {
21
22
  ".": {
22
23
  "types": "./dist/index.d.ts",
23
- "import": "./dist/index.mjs",
24
+ "import": "./dist/index.js",
24
25
  "require": "./dist/index.cjs"
25
26
  },
26
27
  "./vite": {
27
28
  "types": "./dist/vite.d.ts",
28
- "import": "./dist/vite.mjs",
29
+ "import": "./dist/vite.js",
29
30
  "require": "./dist/vite.cjs"
30
31
  },
31
32
  "./webpack": {
32
33
  "types": "./dist/webpack.d.ts",
33
- "import": "./dist/webpack.mjs",
34
+ "import": "./dist/webpack.js",
34
35
  "require": "./dist/webpack.cjs"
35
36
  },
36
37
  "./rollup": {
37
38
  "types": "./dist/rollup.d.ts",
38
- "import": "./dist/rollup.mjs",
39
+ "import": "./dist/rollup.js",
39
40
  "require": "./dist/rollup.cjs"
40
41
  },
41
42
  "./esbuild": {
42
43
  "types": "./dist/esbuild.d.ts",
43
- "import": "./dist/esbuild.mjs",
44
+ "import": "./dist/esbuild.js",
44
45
  "require": "./dist/esbuild.cjs"
45
46
  },
46
- "./nuxt": {
47
- "types": "./dist/nuxt.d.ts",
48
- "import": "./dist/nuxt.mjs",
49
- "require": "./dist/nuxt.cjs"
50
- },
51
- "./utils": {
52
- "types": "./dist/utils.d.ts",
53
- "import": "./dist/utils.mjs",
54
- "require": "./dist/utils.cjs"
55
- },
56
47
  "./*": "./*"
57
48
  },
58
49
  "main": "./dist/index.cjs",
59
- "module": "./dist/index.mjs",
50
+ "module": "./dist/index.js",
60
51
  "types": "./dist/index.d.ts",
61
52
  "typesVersions": {
62
53
  "*": {
@@ -70,36 +61,21 @@
70
61
  "dist"
71
62
  ],
72
63
  "dependencies": {
73
- "@rollup/pluginutils": "^5.1.0",
74
- "is-css-request": "^1.0.0",
75
- "magic-string": "^0.30.10",
76
- "unplugin": "^1.10.1",
77
- "@tailwindcss-mangle/config": "^3.0.0",
78
- "@tailwindcss-mangle/core": "^3.0.0",
79
- "@tailwindcss-mangle/shared": "^3.0.0"
64
+ "@rollup/pluginutils": "^5.1.3",
65
+ "is-css-request": "^1.0.1",
66
+ "magic-string": "^0.30.12",
67
+ "unplugin": "^1.14.1",
68
+ "@tailwindcss-mangle/config": "^4.0.0-alpha.0",
69
+ "@tailwindcss-mangle/core": "^4.0.0-alpha.0",
70
+ "@tailwindcss-mangle/shared": "^4.0.0-alpha.0"
80
71
  },
81
72
  "publishConfig": {
82
73
  "access": "public",
83
74
  "registry": "https://registry.npmjs.org/"
84
75
  },
85
- "devDependencies": {
86
- "@types/babel__helper-plugin-utils": "^7.10.3",
87
- "astro": "^4.11.0",
88
- "css-loader": "^7.1.2",
89
- "html-webpack-plugin": "^5.6.0",
90
- "mini-css-extract-plugin": "^2.9.0",
91
- "normalize-newline": "^4.1.0",
92
- "postcss": "^8.4.38",
93
- "postcss-loader": "^8.1.1",
94
- "tailwindcss": "^3.4.4",
95
- "vite": "^5.3.1",
96
- "webpack": "^5.92.1",
97
- "webpack-build-utils": "^0.0.7",
98
- "tailwindcss-patch": "^3.0.1"
99
- },
100
76
  "scripts": {
101
- "dev": "unbuild --sourcemap",
102
- "build": "unbuild",
77
+ "dev": "tsup --watch --sourcemap",
78
+ "build": "tsup",
103
79
  "test": "vitest run --coverage.enabled",
104
80
  "test:dev": "vitest"
105
81
  }
package/dist/esbuild.cjs DELETED
@@ -1,12 +0,0 @@
1
- 'use strict';
2
-
3
- const index = require('./index.cjs');
4
- require('@tailwindcss-mangle/core');
5
- require('is-css-request');
6
- require('@rollup/pluginutils');
7
- require('unplugin');
8
- require('./shared/unplugin-tailwindcss-mangle.462669b1.cjs');
9
-
10
- const esbuild = index.esbuild;
11
-
12
- module.exports = esbuild;
@@ -1,6 +0,0 @@
1
- import * as esbuild from 'esbuild';
2
- import * as _tailwindcss_mangle_config_index from '@tailwindcss-mangle/config/index';
3
-
4
- declare const _default: (options?: _tailwindcss_mangle_config_index.MangleUserConfig | undefined) => esbuild.Plugin;
5
-
6
- export { _default as default };
@@ -1,6 +0,0 @@
1
- import * as esbuild from 'esbuild';
2
- import * as _tailwindcss_mangle_config_index from '@tailwindcss-mangle/config/index';
3
-
4
- declare const _default: (options?: _tailwindcss_mangle_config_index.MangleUserConfig | undefined) => esbuild.Plugin;
5
-
6
- export { _default as default };
package/dist/esbuild.d.ts DELETED
@@ -1,6 +0,0 @@
1
- import * as esbuild from 'esbuild';
2
- import * as _tailwindcss_mangle_config_index from '@tailwindcss-mangle/config/index';
3
-
4
- declare const _default: (options?: _tailwindcss_mangle_config_index.MangleUserConfig | undefined) => esbuild.Plugin;
5
-
6
- export { _default as default };
package/dist/esbuild.mjs DELETED
@@ -1,10 +0,0 @@
1
- import unplugin from './index.mjs';
2
- import '@tailwindcss-mangle/core';
3
- import 'is-css-request';
4
- import '@rollup/pluginutils';
5
- import 'unplugin';
6
- import './shared/unplugin-tailwindcss-mangle.fdb82141.mjs';
7
-
8
- const esbuild = unplugin.esbuild;
9
-
10
- export { esbuild as default };
package/dist/index.cjs DELETED
@@ -1,66 +0,0 @@
1
- 'use strict';
2
-
3
- const unplugin$1 = require('unplugin');
4
- const core = require('@tailwindcss-mangle/core');
5
- const isCssRequest = require('is-css-request');
6
- const pluginutils = require('@rollup/pluginutils');
7
- const constants = require('./shared/unplugin-tailwindcss-mangle.462669b1.cjs');
8
-
9
- const factory = (options) => {
10
- const ctx = new core.Context();
11
- let filter = (_id) => true;
12
- return [
13
- {
14
- name: `${constants.pluginName}:pre`,
15
- // enforce: 'pre',
16
- async buildStart() {
17
- await ctx.initConfig({
18
- mangleOptions: options
19
- });
20
- filter = pluginutils.createFilter(ctx.options.include, ctx.options.exclude);
21
- }
22
- },
23
- {
24
- name: `${constants.pluginName}`,
25
- transformInclude(id) {
26
- return filter(id);
27
- },
28
- async transform(code, id) {
29
- const opts = {
30
- ctx,
31
- id
32
- };
33
- if (/\.[jt]sx?(?:$|\?)/.test(id)) {
34
- return core.jsHandler(code, opts);
35
- } else if (/\.(?:vue|svelte)(?:$|\?)/.test(id)) {
36
- if (isCssRequest.isCSSRequest(id)) {
37
- return await core.cssHandler(code, opts);
38
- } else {
39
- return core.jsHandler(code, opts);
40
- }
41
- } else if (isCssRequest.isCSSRequest(id)) {
42
- return await core.cssHandler(code, opts);
43
- } else if (/\.html?/.test(id)) {
44
- return core.htmlHandler(code, opts);
45
- }
46
- }
47
- },
48
- {
49
- name: `${constants.pluginName}:post`,
50
- enforce: "post",
51
- vite: {
52
- transformIndexHtml(html) {
53
- const { code } = core.htmlHandler(html, { ctx });
54
- return code;
55
- }
56
- },
57
- writeBundle() {
58
- ctx.dump();
59
- }
60
- }
61
- ];
62
- };
63
-
64
- const unplugin = unplugin$1.createUnplugin(factory);
65
-
66
- module.exports = unplugin;
package/dist/index.d.cts DELETED
@@ -1,6 +0,0 @@
1
- import * as _unplugin from 'unplugin';
2
- import * as _tailwindcss_mangle_config_index from '@tailwindcss-mangle/config/index';
3
-
4
- declare const unplugin: _unplugin.UnpluginInstance<_tailwindcss_mangle_config_index.MangleUserConfig | undefined, boolean>;
5
-
6
- export { unplugin as default };
package/dist/index.d.mts DELETED
@@ -1,6 +0,0 @@
1
- import * as _unplugin from 'unplugin';
2
- import * as _tailwindcss_mangle_config_index from '@tailwindcss-mangle/config/index';
3
-
4
- declare const unplugin: _unplugin.UnpluginInstance<_tailwindcss_mangle_config_index.MangleUserConfig | undefined, boolean>;
5
-
6
- export { unplugin as default };
package/dist/index.d.ts DELETED
@@ -1,6 +0,0 @@
1
- import * as _unplugin from 'unplugin';
2
- import * as _tailwindcss_mangle_config_index from '@tailwindcss-mangle/config/index';
3
-
4
- declare const unplugin: _unplugin.UnpluginInstance<_tailwindcss_mangle_config_index.MangleUserConfig | undefined, boolean>;
5
-
6
- export { unplugin as default };
package/dist/index.mjs DELETED
@@ -1,64 +0,0 @@
1
- import { createUnplugin } from 'unplugin';
2
- import { Context, jsHandler, cssHandler, htmlHandler } from '@tailwindcss-mangle/core';
3
- import { isCSSRequest } from 'is-css-request';
4
- import { createFilter } from '@rollup/pluginutils';
5
- import { p as pluginName } from './shared/unplugin-tailwindcss-mangle.fdb82141.mjs';
6
-
7
- const factory = (options) => {
8
- const ctx = new Context();
9
- let filter = (_id) => true;
10
- return [
11
- {
12
- name: `${pluginName}:pre`,
13
- // enforce: 'pre',
14
- async buildStart() {
15
- await ctx.initConfig({
16
- mangleOptions: options
17
- });
18
- filter = createFilter(ctx.options.include, ctx.options.exclude);
19
- }
20
- },
21
- {
22
- name: `${pluginName}`,
23
- transformInclude(id) {
24
- return filter(id);
25
- },
26
- async transform(code, id) {
27
- const opts = {
28
- ctx,
29
- id
30
- };
31
- if (/\.[jt]sx?(?:$|\?)/.test(id)) {
32
- return jsHandler(code, opts);
33
- } else if (/\.(?:vue|svelte)(?:$|\?)/.test(id)) {
34
- if (isCSSRequest(id)) {
35
- return await cssHandler(code, opts);
36
- } else {
37
- return jsHandler(code, opts);
38
- }
39
- } else if (isCSSRequest(id)) {
40
- return await cssHandler(code, opts);
41
- } else if (/\.html?/.test(id)) {
42
- return htmlHandler(code, opts);
43
- }
44
- }
45
- },
46
- {
47
- name: `${pluginName}:post`,
48
- enforce: "post",
49
- vite: {
50
- transformIndexHtml(html) {
51
- const { code } = htmlHandler(html, { ctx });
52
- return code;
53
- }
54
- },
55
- writeBundle() {
56
- ctx.dump();
57
- }
58
- }
59
- ];
60
- };
61
-
62
- const unplugin = createUnplugin(factory);
63
-
64
- export { unplugin as default };
package/dist/nuxt.cjs DELETED
@@ -1,21 +0,0 @@
1
- 'use strict';
2
-
3
- const index = require('./index.cjs');
4
- require('@tailwindcss-mangle/core');
5
- require('is-css-request');
6
- require('@rollup/pluginutils');
7
- require('unplugin');
8
- require('./shared/unplugin-tailwindcss-mangle.462669b1.cjs');
9
-
10
- function nuxt(options = {}, nuxt) {
11
- nuxt.hook("webpack:config", (config) => {
12
- config.plugins = config.plugins || [];
13
- config.plugins.unshift(index.webpack(options));
14
- });
15
- nuxt.hook("vite:extendConfig", (config) => {
16
- config.plugins = config.plugins || [];
17
- config.plugins.push(index.vite(options));
18
- });
19
- }
20
-
21
- module.exports = nuxt;
package/dist/nuxt.d.cts DELETED
@@ -1,5 +0,0 @@
1
- import { MangleUserConfig } from '@tailwindcss-mangle/config';
2
-
3
- declare function export_default(options: MangleUserConfig | undefined, nuxt: any): void;
4
-
5
- export { export_default as default };
package/dist/nuxt.d.mts DELETED
@@ -1,5 +0,0 @@
1
- import { MangleUserConfig } from '@tailwindcss-mangle/config';
2
-
3
- declare function export_default(options: MangleUserConfig | undefined, nuxt: any): void;
4
-
5
- export { export_default as default };
package/dist/nuxt.d.ts DELETED
@@ -1,5 +0,0 @@
1
- import { MangleUserConfig } from '@tailwindcss-mangle/config';
2
-
3
- declare function export_default(options: MangleUserConfig | undefined, nuxt: any): void;
4
-
5
- export { export_default as default };
package/dist/nuxt.mjs DELETED
@@ -1,19 +0,0 @@
1
- import unplugin from './index.mjs';
2
- import '@tailwindcss-mangle/core';
3
- import 'is-css-request';
4
- import '@rollup/pluginutils';
5
- import 'unplugin';
6
- import './shared/unplugin-tailwindcss-mangle.fdb82141.mjs';
7
-
8
- function nuxt(options = {}, nuxt) {
9
- nuxt.hook("webpack:config", (config) => {
10
- config.plugins = config.plugins || [];
11
- config.plugins.unshift(unplugin.webpack(options));
12
- });
13
- nuxt.hook("vite:extendConfig", (config) => {
14
- config.plugins = config.plugins || [];
15
- config.plugins.push(unplugin.vite(options));
16
- });
17
- }
18
-
19
- export { nuxt as default };
package/dist/rollup.cjs DELETED
@@ -1,12 +0,0 @@
1
- 'use strict';
2
-
3
- const index = require('./index.cjs');
4
- require('@tailwindcss-mangle/core');
5
- require('is-css-request');
6
- require('@rollup/pluginutils');
7
- require('unplugin');
8
- require('./shared/unplugin-tailwindcss-mangle.462669b1.cjs');
9
-
10
- const rollup = index.rollup;
11
-
12
- module.exports = rollup;
package/dist/rollup.d.cts DELETED
@@ -1,6 +0,0 @@
1
- import * as rollup from 'rollup';
2
- import * as _tailwindcss_mangle_config_index from '@tailwindcss-mangle/config/index';
3
-
4
- declare const _default: (options?: _tailwindcss_mangle_config_index.MangleUserConfig | undefined) => rollup.Plugin<any> | rollup.Plugin<any>[];
5
-
6
- export { _default as default };
package/dist/rollup.d.mts DELETED
@@ -1,6 +0,0 @@
1
- import * as rollup from 'rollup';
2
- import * as _tailwindcss_mangle_config_index from '@tailwindcss-mangle/config/index';
3
-
4
- declare const _default: (options?: _tailwindcss_mangle_config_index.MangleUserConfig | undefined) => rollup.Plugin<any> | rollup.Plugin<any>[];
5
-
6
- export { _default as default };
package/dist/rollup.d.ts DELETED
@@ -1,6 +0,0 @@
1
- import * as rollup from 'rollup';
2
- import * as _tailwindcss_mangle_config_index from '@tailwindcss-mangle/config/index';
3
-
4
- declare const _default: (options?: _tailwindcss_mangle_config_index.MangleUserConfig | undefined) => rollup.Plugin<any> | rollup.Plugin<any>[];
5
-
6
- export { _default as default };
package/dist/rollup.mjs DELETED
@@ -1,10 +0,0 @@
1
- import unplugin from './index.mjs';
2
- import '@tailwindcss-mangle/core';
3
- import 'is-css-request';
4
- import '@rollup/pluginutils';
5
- import 'unplugin';
6
- import './shared/unplugin-tailwindcss-mangle.fdb82141.mjs';
7
-
8
- const rollup = unplugin.rollup;
9
-
10
- export { rollup as default };
@@ -1,5 +0,0 @@
1
- 'use strict';
2
-
3
- const pluginName = "unplugin-tailwindcss-mangle";
4
-
5
- exports.pluginName = pluginName;
@@ -1,3 +0,0 @@
1
- const pluginName = "unplugin-tailwindcss-mangle";
2
-
3
- export { pluginName as p };
package/dist/utils.cjs DELETED
@@ -1,77 +0,0 @@
1
- 'use strict';
2
-
3
- const fs = require('node:fs/promises');
4
- const path = require('node:path');
5
- const process = require('node:process');
6
- const shared = require('@tailwindcss-mangle/shared');
7
- const constants = require('./shared/unplugin-tailwindcss-mangle.462669b1.cjs');
8
-
9
- function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e.default : e; }
10
-
11
- const fs__default = /*#__PURE__*/_interopDefaultCompat(fs);
12
- const path__default = /*#__PURE__*/_interopDefaultCompat(path);
13
- const process__default = /*#__PURE__*/_interopDefaultCompat(process);
14
-
15
- function escapeStringRegexp(str) {
16
- if (typeof str !== "string") {
17
- throw new TypeError("Expected a string");
18
- }
19
- return str.replaceAll(/[$()*+.?[\\\]^{|}]/g, "\\$&").replaceAll("-", "\\x2d");
20
- }
21
- function getGroupedEntries(entries, options = {
22
- cssMatcher(file) {
23
- return /\.css$/.test(file);
24
- },
25
- htmlMatcher(file) {
26
- return /\.html?$/.test(file);
27
- },
28
- jsMatcher(file) {
29
- return /\.[cm]?js$/.test(file);
30
- }
31
- }) {
32
- const { cssMatcher, htmlMatcher, jsMatcher } = options;
33
- const groupedEntries = shared.groupBy(entries, ([file]) => {
34
- if (cssMatcher(file)) {
35
- return "css";
36
- } else if (htmlMatcher(file)) {
37
- return "html";
38
- } else if (jsMatcher(file)) {
39
- return "js";
40
- } else {
41
- return "other";
42
- }
43
- });
44
- if (!groupedEntries.css) {
45
- groupedEntries.css = [];
46
- }
47
- if (!groupedEntries.html) {
48
- groupedEntries.html = [];
49
- }
50
- if (!groupedEntries.js) {
51
- groupedEntries.js = [];
52
- }
53
- if (!groupedEntries.other) {
54
- groupedEntries.other = [];
55
- }
56
- return groupedEntries;
57
- }
58
- function getCacheDir(basedir = process__default.cwd()) {
59
- return path__default.resolve(basedir, "node_modules/.cache", constants.pluginName);
60
- }
61
- async function ensureDir(p) {
62
- try {
63
- await fs__default.access(p);
64
- } catch {
65
- await fs__default.mkdir(p, {
66
- recursive: true
67
- });
68
- }
69
- }
70
-
71
- exports.defaultMangleClassFilter = shared.defaultMangleClassFilter;
72
- exports.isMap = shared.isMap;
73
- exports.isRegexp = shared.isRegexp;
74
- exports.ensureDir = ensureDir;
75
- exports.escapeStringRegexp = escapeStringRegexp;
76
- exports.getCacheDir = getCacheDir;
77
- exports.getGroupedEntries = getGroupedEntries;
package/dist/utils.d.cts DELETED
@@ -1,12 +0,0 @@
1
- export { defaultMangleClassFilter, isMap, isRegexp } from '@tailwindcss-mangle/shared';
2
-
3
- declare function escapeStringRegexp(str: string): string;
4
- declare function getGroupedEntries<T>(entries: [string, T][], options?: {
5
- cssMatcher(file: string): boolean;
6
- htmlMatcher(file: string): boolean;
7
- jsMatcher(file: string): boolean;
8
- }): Record<"css" | "html" | "js" | "other", [string, T][]>;
9
- declare function getCacheDir(basedir?: string): string;
10
- declare function ensureDir(p: string): Promise<void>;
11
-
12
- export { ensureDir, escapeStringRegexp, getCacheDir, getGroupedEntries };
package/dist/utils.d.mts DELETED
@@ -1,12 +0,0 @@
1
- export { defaultMangleClassFilter, isMap, isRegexp } from '@tailwindcss-mangle/shared';
2
-
3
- declare function escapeStringRegexp(str: string): string;
4
- declare function getGroupedEntries<T>(entries: [string, T][], options?: {
5
- cssMatcher(file: string): boolean;
6
- htmlMatcher(file: string): boolean;
7
- jsMatcher(file: string): boolean;
8
- }): Record<"css" | "html" | "js" | "other", [string, T][]>;
9
- declare function getCacheDir(basedir?: string): string;
10
- declare function ensureDir(p: string): Promise<void>;
11
-
12
- export { ensureDir, escapeStringRegexp, getCacheDir, getGroupedEntries };
package/dist/utils.d.ts DELETED
@@ -1,12 +0,0 @@
1
- export { defaultMangleClassFilter, isMap, isRegexp } from '@tailwindcss-mangle/shared';
2
-
3
- declare function escapeStringRegexp(str: string): string;
4
- declare function getGroupedEntries<T>(entries: [string, T][], options?: {
5
- cssMatcher(file: string): boolean;
6
- htmlMatcher(file: string): boolean;
7
- jsMatcher(file: string): boolean;
8
- }): Record<"css" | "html" | "js" | "other", [string, T][]>;
9
- declare function getCacheDir(basedir?: string): string;
10
- declare function ensureDir(p: string): Promise<void>;
11
-
12
- export { ensureDir, escapeStringRegexp, getCacheDir, getGroupedEntries };
package/dist/utils.mjs DELETED
@@ -1,64 +0,0 @@
1
- import fs from 'node:fs/promises';
2
- import path from 'node:path';
3
- import process from 'node:process';
4
- import { groupBy } from '@tailwindcss-mangle/shared';
5
- export { defaultMangleClassFilter, isMap, isRegexp } from '@tailwindcss-mangle/shared';
6
- import { p as pluginName } from './shared/unplugin-tailwindcss-mangle.fdb82141.mjs';
7
-
8
- function escapeStringRegexp(str) {
9
- if (typeof str !== "string") {
10
- throw new TypeError("Expected a string");
11
- }
12
- return str.replaceAll(/[$()*+.?[\\\]^{|}]/g, "\\$&").replaceAll("-", "\\x2d");
13
- }
14
- function getGroupedEntries(entries, options = {
15
- cssMatcher(file) {
16
- return /\.css$/.test(file);
17
- },
18
- htmlMatcher(file) {
19
- return /\.html?$/.test(file);
20
- },
21
- jsMatcher(file) {
22
- return /\.[cm]?js$/.test(file);
23
- }
24
- }) {
25
- const { cssMatcher, htmlMatcher, jsMatcher } = options;
26
- const groupedEntries = groupBy(entries, ([file]) => {
27
- if (cssMatcher(file)) {
28
- return "css";
29
- } else if (htmlMatcher(file)) {
30
- return "html";
31
- } else if (jsMatcher(file)) {
32
- return "js";
33
- } else {
34
- return "other";
35
- }
36
- });
37
- if (!groupedEntries.css) {
38
- groupedEntries.css = [];
39
- }
40
- if (!groupedEntries.html) {
41
- groupedEntries.html = [];
42
- }
43
- if (!groupedEntries.js) {
44
- groupedEntries.js = [];
45
- }
46
- if (!groupedEntries.other) {
47
- groupedEntries.other = [];
48
- }
49
- return groupedEntries;
50
- }
51
- function getCacheDir(basedir = process.cwd()) {
52
- return path.resolve(basedir, "node_modules/.cache", pluginName);
53
- }
54
- async function ensureDir(p) {
55
- try {
56
- await fs.access(p);
57
- } catch {
58
- await fs.mkdir(p, {
59
- recursive: true
60
- });
61
- }
62
- }
63
-
64
- export { ensureDir, escapeStringRegexp, getCacheDir, getGroupedEntries };
package/dist/vite.cjs DELETED
@@ -1,12 +0,0 @@
1
- 'use strict';
2
-
3
- const index = require('./index.cjs');
4
- require('@tailwindcss-mangle/core');
5
- require('is-css-request');
6
- require('@rollup/pluginutils');
7
- require('unplugin');
8
- require('./shared/unplugin-tailwindcss-mangle.462669b1.cjs');
9
-
10
- const vite = index.vite;
11
-
12
- module.exports = vite;
package/dist/vite.d.cts DELETED
@@ -1,6 +0,0 @@
1
- import * as vite from 'vite';
2
- import * as _tailwindcss_mangle_config_index from '@tailwindcss-mangle/config/index';
3
-
4
- declare const _default: (options?: _tailwindcss_mangle_config_index.MangleUserConfig | undefined) => vite.Plugin<any> | vite.Plugin<any>[];
5
-
6
- export { _default as default };
package/dist/vite.d.mts DELETED
@@ -1,6 +0,0 @@
1
- import * as vite from 'vite';
2
- import * as _tailwindcss_mangle_config_index from '@tailwindcss-mangle/config/index';
3
-
4
- declare const _default: (options?: _tailwindcss_mangle_config_index.MangleUserConfig | undefined) => vite.Plugin<any> | vite.Plugin<any>[];
5
-
6
- export { _default as default };
package/dist/vite.d.ts DELETED
@@ -1,6 +0,0 @@
1
- import * as vite from 'vite';
2
- import * as _tailwindcss_mangle_config_index from '@tailwindcss-mangle/config/index';
3
-
4
- declare const _default: (options?: _tailwindcss_mangle_config_index.MangleUserConfig | undefined) => vite.Plugin<any> | vite.Plugin<any>[];
5
-
6
- export { _default as default };
package/dist/vite.mjs DELETED
@@ -1,10 +0,0 @@
1
- import unplugin from './index.mjs';
2
- import '@tailwindcss-mangle/core';
3
- import 'is-css-request';
4
- import '@rollup/pluginutils';
5
- import 'unplugin';
6
- import './shared/unplugin-tailwindcss-mangle.fdb82141.mjs';
7
-
8
- const vite = unplugin.vite;
9
-
10
- export { vite as default };
package/dist/webpack.cjs DELETED
@@ -1,12 +0,0 @@
1
- 'use strict';
2
-
3
- const index = require('./index.cjs');
4
- require('@tailwindcss-mangle/core');
5
- require('is-css-request');
6
- require('@rollup/pluginutils');
7
- require('unplugin');
8
- require('./shared/unplugin-tailwindcss-mangle.462669b1.cjs');
9
-
10
- const webpack = index.webpack;
11
-
12
- module.exports = webpack;
@@ -1,6 +0,0 @@
1
- import * as webpack from 'webpack';
2
- import * as _tailwindcss_mangle_config_index from '@tailwindcss-mangle/config/index';
3
-
4
- declare const _default: (options?: _tailwindcss_mangle_config_index.MangleUserConfig | undefined) => webpack.WebpackPluginInstance;
5
-
6
- export { _default as default };
@@ -1,6 +0,0 @@
1
- import * as webpack from 'webpack';
2
- import * as _tailwindcss_mangle_config_index from '@tailwindcss-mangle/config/index';
3
-
4
- declare const _default: (options?: _tailwindcss_mangle_config_index.MangleUserConfig | undefined) => webpack.WebpackPluginInstance;
5
-
6
- export { _default as default };
package/dist/webpack.d.ts DELETED
@@ -1,6 +0,0 @@
1
- import * as webpack from 'webpack';
2
- import * as _tailwindcss_mangle_config_index from '@tailwindcss-mangle/config/index';
3
-
4
- declare const _default: (options?: _tailwindcss_mangle_config_index.MangleUserConfig | undefined) => webpack.WebpackPluginInstance;
5
-
6
- export { _default as default };
package/dist/webpack.mjs DELETED
@@ -1,10 +0,0 @@
1
- import unplugin from './index.mjs';
2
- import '@tailwindcss-mangle/core';
3
- import 'is-css-request';
4
- import '@rollup/pluginutils';
5
- import 'unplugin';
6
- import './shared/unplugin-tailwindcss-mangle.fdb82141.mjs';
7
-
8
- const webpack = unplugin.webpack;
9
-
10
- export { webpack as default };