unplugin-tailwindcss-mangle 3.0.1 → 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.1",
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,33 +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
47
  "./*": "./*"
47
48
  },
48
49
  "main": "./dist/index.cjs",
49
- "module": "./dist/index.mjs",
50
+ "module": "./dist/index.js",
50
51
  "types": "./dist/index.d.ts",
51
52
  "typesVersions": {
52
53
  "*": {
@@ -60,36 +61,21 @@
60
61
  "dist"
61
62
  ],
62
63
  "dependencies": {
63
- "@rollup/pluginutils": "^5.1.0",
64
+ "@rollup/pluginutils": "^5.1.3",
64
65
  "is-css-request": "^1.0.1",
65
- "magic-string": "^0.30.10",
66
- "unplugin": "^1.11.0",
67
- "@tailwindcss-mangle/shared": "^3.0.0",
68
- "@tailwindcss-mangle/config": "^3.0.0",
69
- "@tailwindcss-mangle/core": "^3.0.0"
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"
70
71
  },
71
72
  "publishConfig": {
72
73
  "access": "public",
73
74
  "registry": "https://registry.npmjs.org/"
74
75
  },
75
- "devDependencies": {
76
- "@types/babel__helper-plugin-utils": "^7.10.3",
77
- "astro": "^4.11.5",
78
- "css-loader": "^7.1.2",
79
- "html-webpack-plugin": "^5.6.0",
80
- "mini-css-extract-plugin": "^2.9.0",
81
- "normalize-newline": "^4.1.0",
82
- "postcss": "^8.4.38",
83
- "postcss-loader": "^8.1.1",
84
- "tailwindcss": "^3.4.4",
85
- "vite": "^5.3.3",
86
- "webpack": "^5.93.0",
87
- "webpack-build-utils": "^0.0.7",
88
- "tailwindcss-patch": "^3.0.2"
89
- },
90
76
  "scripts": {
91
- "dev": "unbuild --sourcemap",
92
- "build": "unbuild",
77
+ "dev": "tsup --watch --sourcemap",
78
+ "build": "tsup",
93
79
  "test": "vitest run --coverage.enabled",
94
80
  "test:dev": "vitest"
95
81
  }
@@ -1,15 +0,0 @@
1
- 'use strict';
2
-
3
- const core = require('@tailwindcss-mangle/core');
4
-
5
- const TailwindcssMangleWebpackLoader = async function(source) {
6
- const callback = this.async();
7
- const { ctx } = this.getOptions();
8
- const { code } = await core.cssHandler(source, {
9
- ctx,
10
- id: this.resource
11
- });
12
- callback(null, code);
13
- };
14
-
15
- module.exports = TailwindcssMangleWebpackLoader;
@@ -1,8 +0,0 @@
1
- import { LoaderContext } from 'webpack';
2
- import { Context } from '@tailwindcss-mangle/core';
3
-
4
- declare const TailwindcssMangleWebpackLoader: (this: LoaderContext<{
5
- ctx: Context;
6
- }>, source: string) => Promise<void>;
7
-
8
- export { TailwindcssMangleWebpackLoader as default };
@@ -1,8 +0,0 @@
1
- import { LoaderContext } from 'webpack';
2
- import { Context } from '@tailwindcss-mangle/core';
3
-
4
- declare const TailwindcssMangleWebpackLoader: (this: LoaderContext<{
5
- ctx: Context;
6
- }>, source: string) => Promise<void>;
7
-
8
- export { TailwindcssMangleWebpackLoader as default };
@@ -1,8 +0,0 @@
1
- import { LoaderContext } from 'webpack';
2
- import { Context } from '@tailwindcss-mangle/core';
3
-
4
- declare const TailwindcssMangleWebpackLoader: (this: LoaderContext<{
5
- ctx: Context;
6
- }>, source: string) => Promise<void>;
7
-
8
- export { TailwindcssMangleWebpackLoader as default };
@@ -1,13 +0,0 @@
1
- import { cssHandler } from '@tailwindcss-mangle/core';
2
-
3
- const TailwindcssMangleWebpackLoader = async function(source) {
4
- const callback = this.async();
5
- const { ctx } = this.getOptions();
6
- const { code } = await cssHandler(source, {
7
- ctx,
8
- id: this.resource
9
- });
10
- callback(null, code);
11
- };
12
-
13
- export { TailwindcssMangleWebpackLoader as default };
package/dist/esbuild.cjs DELETED
@@ -1,16 +0,0 @@
1
- 'use strict';
2
-
3
- const index = require('./index.cjs');
4
- require('unplugin');
5
- require('node:path');
6
- require('@tailwindcss-mangle/core');
7
- require('is-css-request');
8
- require('@rollup/pluginutils');
9
- require('./shared/unplugin-tailwindcss-mangle.14c63525.cjs');
10
- require('node:fs/promises');
11
- require('node:process');
12
- require('@tailwindcss-mangle/shared');
13
-
14
- const esbuild = index.esbuild;
15
-
16
- module.exports = esbuild;
@@ -1,6 +0,0 @@
1
- import * as esbuild from 'esbuild';
2
- import * as _tailwindcss_mangle_config from '@tailwindcss-mangle/config';
3
-
4
- declare const _default: (options?: _tailwindcss_mangle_config.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 from '@tailwindcss-mangle/config';
3
-
4
- declare const _default: (options?: _tailwindcss_mangle_config.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 from '@tailwindcss-mangle/config';
3
-
4
- declare const _default: (options?: _tailwindcss_mangle_config.MangleUserConfig | undefined) => esbuild.Plugin;
5
-
6
- export { _default as default };
package/dist/esbuild.mjs DELETED
@@ -1,14 +0,0 @@
1
- import unplugin from './index.mjs';
2
- import 'unplugin';
3
- import 'node:path';
4
- import '@tailwindcss-mangle/core';
5
- import 'is-css-request';
6
- import '@rollup/pluginutils';
7
- import './shared/unplugin-tailwindcss-mangle.077d08fc.mjs';
8
- import 'node:fs/promises';
9
- import 'node:process';
10
- import '@tailwindcss-mangle/shared';
11
-
12
- const esbuild = unplugin.esbuild;
13
-
14
- export { esbuild as default };
package/dist/index.cjs DELETED
@@ -1,136 +0,0 @@
1
- 'use strict';
2
-
3
- const unplugin$1 = require('unplugin');
4
- const path = require('node:path');
5
- const core = require('@tailwindcss-mangle/core');
6
- const isCssRequest = require('is-css-request');
7
- const pluginutils = require('@rollup/pluginutils');
8
- const utils = require('./shared/unplugin-tailwindcss-mangle.14c63525.cjs');
9
- require('node:fs/promises');
10
- require('node:process');
11
- require('@tailwindcss-mangle/shared');
12
-
13
- function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e.default : e; }
14
-
15
- const path__default = /*#__PURE__*/_interopDefaultCompat(path);
16
-
17
- const WEBPACK_LOADER = path__default.resolve(__dirname, "core/loader.cjs");
18
- const factory = (options, { framework }) => {
19
- const ctx = new core.Context();
20
- let filter = (_id) => true;
21
- return [
22
- {
23
- name: `${utils.pluginName}:pre`,
24
- enforce: "pre",
25
- async buildStart() {
26
- await ctx.initConfig({
27
- mangleOptions: options
28
- });
29
- filter = pluginutils.createFilter(ctx.options.include, ctx.options.exclude);
30
- }
31
- },
32
- {
33
- name: `${utils.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 core.jsHandler(code, opts);
44
- } else if (/\.(?:vue|svelte)(?:$|\?)/.test(id)) {
45
- if (isCssRequest.isCSSRequest(id)) {
46
- return await core.cssHandler(code, opts);
47
- } else {
48
- return core.jsHandler(code, opts);
49
- }
50
- } else if (isCssRequest.isCSSRequest(id)) {
51
- return await core.cssHandler(code, opts);
52
- } else if (/\.html?/.test(id)) {
53
- return core.htmlHandler(code, opts);
54
- }
55
- },
56
- webpack(compiler) {
57
- const { NormalModule } = compiler.webpack;
58
- compiler.hooks.compilation.tap(utils.pluginName, (compilation) => {
59
- NormalModule.getCompilationHooks(compilation).loader.tap(utils.pluginName, (_loaderContext, module) => {
60
- {
61
- const idx = module.loaders.findIndex((x) => x.loader.includes("postcss-loader"));
62
- if (idx > -1) {
63
- module.loaders.splice(idx, 0, {
64
- loader: WEBPACK_LOADER,
65
- ident: null,
66
- options: {
67
- ctx
68
- },
69
- type: null
70
- });
71
- }
72
- }
73
- });
74
- });
75
- }
76
- },
77
- {
78
- name: `${utils.pluginName}:post`,
79
- enforce: "post",
80
- vite: {
81
- transformIndexHtml(html) {
82
- const { code } = core.htmlHandler(html, { ctx });
83
- return code;
84
- }
85
- // generateBundle: {
86
- // async handler(options, bundle) {
87
- // const groupedEntries = getGroupedEntries(Object.entries(bundle))
88
- // if (Array.isArray(groupedEntries.css) && groupedEntries.css.length > 0) {
89
- // for (let i = 0; i < groupedEntries.css.length; i++) {
90
- // const [id, cssSource] = groupedEntries.css[i] as [string, OutputAsset]
91
- // const { code } = await cssHandler(cssSource.source.toString(), {
92
- // id,
93
- // ctx,
94
- // })
95
- // cssSource.source = code
96
- // }
97
- // }
98
- // },
99
- // },
100
- },
101
- webpack(compiler) {
102
- const { Compilation, sources } = compiler.webpack;
103
- const { ConcatSource } = sources;
104
- compiler.hooks.compilation.tap(utils.pluginName, (compilation) => {
105
- compilation.hooks.processAssets.tapPromise(
106
- {
107
- name: utils.pluginName,
108
- stage: Compilation.PROCESS_ASSETS_STAGE_SUMMARIZE
109
- },
110
- async (assets) => {
111
- const groupedEntries = utils.getGroupedEntries(Object.entries(assets));
112
- if (groupedEntries.css.length > 0) {
113
- for (let i = 0; i < groupedEntries.css.length; i++) {
114
- const [id, cssSource] = groupedEntries.css[i];
115
- const { code } = await core.cssHandler(cssSource.source().toString(), {
116
- id,
117
- ctx
118
- });
119
- const source = new ConcatSource(code);
120
- compilation.updateAsset(id, source);
121
- }
122
- }
123
- }
124
- );
125
- });
126
- },
127
- writeBundle() {
128
- ctx.dump();
129
- }
130
- }
131
- ];
132
- };
133
-
134
- const unplugin = unplugin$1.createUnplugin(factory);
135
-
136
- 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 from '@tailwindcss-mangle/config';
3
-
4
- declare const unplugin: _unplugin.UnpluginInstance<_tailwindcss_mangle_config.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 from '@tailwindcss-mangle/config';
3
-
4
- declare const unplugin: _unplugin.UnpluginInstance<_tailwindcss_mangle_config.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 from '@tailwindcss-mangle/config';
3
-
4
- declare const unplugin: _unplugin.UnpluginInstance<_tailwindcss_mangle_config.MangleUserConfig | undefined, boolean>;
5
-
6
- export { unplugin as default };
package/dist/index.mjs DELETED
@@ -1,139 +0,0 @@
1
- import { createUnplugin } from 'unplugin';
2
- import path from 'node:path';
3
- import { Context, jsHandler, cssHandler, htmlHandler } from '@tailwindcss-mangle/core';
4
- import { isCSSRequest } from 'is-css-request';
5
- import { createFilter } from '@rollup/pluginutils';
6
- import { p as pluginName, g as getGroupedEntries } from './shared/unplugin-tailwindcss-mangle.077d08fc.mjs';
7
- import 'node:fs/promises';
8
- import 'node:process';
9
- import '@tailwindcss-mangle/shared';
10
-
11
-
12
-
13
- // -- Unbuild CommonJS Shims --
14
- import __cjs_url__ from 'url';
15
- import __cjs_path__ from 'path';
16
- import __cjs_mod__ from 'module';
17
- const __filename = __cjs_url__.fileURLToPath(import.meta.url);
18
- const __dirname = __cjs_path__.dirname(__filename);
19
- const require = __cjs_mod__.createRequire(import.meta.url);
20
- const WEBPACK_LOADER = path.resolve(__dirname, "core/loader.cjs");
21
- const factory = (options, { framework }) => {
22
- const ctx = new Context();
23
- let filter = (_id) => true;
24
- return [
25
- {
26
- name: `${pluginName}:pre`,
27
- enforce: "pre",
28
- async buildStart() {
29
- await ctx.initConfig({
30
- mangleOptions: options
31
- });
32
- filter = createFilter(ctx.options.include, ctx.options.exclude);
33
- }
34
- },
35
- {
36
- name: `${pluginName}`,
37
- transformInclude(id) {
38
- return filter(id);
39
- },
40
- async transform(code, id) {
41
- const opts = {
42
- ctx,
43
- id
44
- };
45
- if (/\.[jt]sx?(?:$|\?)/.test(id)) {
46
- return jsHandler(code, opts);
47
- } else if (/\.(?:vue|svelte)(?:$|\?)/.test(id)) {
48
- if (isCSSRequest(id)) {
49
- return await cssHandler(code, opts);
50
- } else {
51
- return jsHandler(code, opts);
52
- }
53
- } else if (isCSSRequest(id)) {
54
- return await cssHandler(code, opts);
55
- } else if (/\.html?/.test(id)) {
56
- return htmlHandler(code, opts);
57
- }
58
- },
59
- webpack(compiler) {
60
- const { NormalModule } = compiler.webpack;
61
- compiler.hooks.compilation.tap(pluginName, (compilation) => {
62
- NormalModule.getCompilationHooks(compilation).loader.tap(pluginName, (_loaderContext, module) => {
63
- {
64
- const idx = module.loaders.findIndex((x) => x.loader.includes("postcss-loader"));
65
- if (idx > -1) {
66
- module.loaders.splice(idx, 0, {
67
- loader: WEBPACK_LOADER,
68
- ident: null,
69
- options: {
70
- ctx
71
- },
72
- type: null
73
- });
74
- }
75
- }
76
- });
77
- });
78
- }
79
- },
80
- {
81
- name: `${pluginName}:post`,
82
- enforce: "post",
83
- vite: {
84
- transformIndexHtml(html) {
85
- const { code } = htmlHandler(html, { ctx });
86
- return code;
87
- }
88
- // generateBundle: {
89
- // async handler(options, bundle) {
90
- // const groupedEntries = getGroupedEntries(Object.entries(bundle))
91
- // if (Array.isArray(groupedEntries.css) && groupedEntries.css.length > 0) {
92
- // for (let i = 0; i < groupedEntries.css.length; i++) {
93
- // const [id, cssSource] = groupedEntries.css[i] as [string, OutputAsset]
94
- // const { code } = await cssHandler(cssSource.source.toString(), {
95
- // id,
96
- // ctx,
97
- // })
98
- // cssSource.source = code
99
- // }
100
- // }
101
- // },
102
- // },
103
- },
104
- webpack(compiler) {
105
- const { Compilation, sources } = compiler.webpack;
106
- const { ConcatSource } = sources;
107
- compiler.hooks.compilation.tap(pluginName, (compilation) => {
108
- compilation.hooks.processAssets.tapPromise(
109
- {
110
- name: pluginName,
111
- stage: Compilation.PROCESS_ASSETS_STAGE_SUMMARIZE
112
- },
113
- async (assets) => {
114
- const groupedEntries = getGroupedEntries(Object.entries(assets));
115
- if (groupedEntries.css.length > 0) {
116
- for (let i = 0; i < groupedEntries.css.length; i++) {
117
- const [id, cssSource] = groupedEntries.css[i];
118
- const { code } = await cssHandler(cssSource.source().toString(), {
119
- id,
120
- ctx
121
- });
122
- const source = new ConcatSource(code);
123
- compilation.updateAsset(id, source);
124
- }
125
- }
126
- }
127
- );
128
- });
129
- },
130
- writeBundle() {
131
- ctx.dump();
132
- }
133
- }
134
- ];
135
- };
136
-
137
- const unplugin = createUnplugin(factory);
138
-
139
- export { unplugin as default };
package/dist/rollup.cjs DELETED
@@ -1,16 +0,0 @@
1
- 'use strict';
2
-
3
- const index = require('./index.cjs');
4
- require('unplugin');
5
- require('node:path');
6
- require('@tailwindcss-mangle/core');
7
- require('is-css-request');
8
- require('@rollup/pluginutils');
9
- require('./shared/unplugin-tailwindcss-mangle.14c63525.cjs');
10
- require('node:fs/promises');
11
- require('node:process');
12
- require('@tailwindcss-mangle/shared');
13
-
14
- const rollup = index.rollup;
15
-
16
- 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 from '@tailwindcss-mangle/config';
3
-
4
- declare const _default: (options?: _tailwindcss_mangle_config.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 from '@tailwindcss-mangle/config';
3
-
4
- declare const _default: (options?: _tailwindcss_mangle_config.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 from '@tailwindcss-mangle/config';
3
-
4
- declare const _default: (options?: _tailwindcss_mangle_config.MangleUserConfig | undefined) => rollup.Plugin<any> | rollup.Plugin<any>[];
5
-
6
- export { _default as default };
package/dist/rollup.mjs DELETED
@@ -1,14 +0,0 @@
1
- import unplugin from './index.mjs';
2
- import 'unplugin';
3
- import 'node:path';
4
- import '@tailwindcss-mangle/core';
5
- import 'is-css-request';
6
- import '@rollup/pluginutils';
7
- import './shared/unplugin-tailwindcss-mangle.077d08fc.mjs';
8
- import 'node:fs/promises';
9
- import 'node:process';
10
- import '@tailwindcss-mangle/shared';
11
-
12
- const rollup = unplugin.rollup;
13
-
14
- export { rollup as default };
@@ -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
-
6
- const pluginName = "unplugin-tailwindcss-mangle";
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 { getCacheDir as a, ensureDir as b, escapeStringRegexp as e, getGroupedEntries as g, pluginName as p };
@@ -1,76 +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
-
8
- function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e.default : e; }
9
-
10
- const fs__default = /*#__PURE__*/_interopDefaultCompat(fs);
11
- const path__default = /*#__PURE__*/_interopDefaultCompat(path);
12
- const process__default = /*#__PURE__*/_interopDefaultCompat(process);
13
-
14
- const pluginName = "unplugin-tailwindcss-mangle";
15
-
16
- function escapeStringRegexp(str) {
17
- if (typeof str !== "string") {
18
- throw new TypeError("Expected a string");
19
- }
20
- return str.replaceAll(/[$()*+.?[\\\]^{|}]/g, "\\$&").replaceAll("-", "\\x2d");
21
- }
22
- function getGroupedEntries(entries, options = {
23
- cssMatcher(file) {
24
- return /\.css$/.test(file);
25
- },
26
- htmlMatcher(file) {
27
- return /\.html?$/.test(file);
28
- },
29
- jsMatcher(file) {
30
- return /\.[cm]?js$/.test(file);
31
- }
32
- }) {
33
- const { cssMatcher, htmlMatcher, jsMatcher } = options;
34
- const groupedEntries = shared.groupBy(entries, ([file]) => {
35
- if (cssMatcher(file)) {
36
- return "css";
37
- } else if (htmlMatcher(file)) {
38
- return "html";
39
- } else if (jsMatcher(file)) {
40
- return "js";
41
- } else {
42
- return "other";
43
- }
44
- });
45
- if (!groupedEntries.css) {
46
- groupedEntries.css = [];
47
- }
48
- if (!groupedEntries.html) {
49
- groupedEntries.html = [];
50
- }
51
- if (!groupedEntries.js) {
52
- groupedEntries.js = [];
53
- }
54
- if (!groupedEntries.other) {
55
- groupedEntries.other = [];
56
- }
57
- return groupedEntries;
58
- }
59
- function getCacheDir(basedir = process__default.cwd()) {
60
- return path__default.resolve(basedir, "node_modules/.cache", pluginName);
61
- }
62
- async function ensureDir(p) {
63
- try {
64
- await fs__default.access(p);
65
- } catch {
66
- await fs__default.mkdir(p, {
67
- recursive: true
68
- });
69
- }
70
- }
71
-
72
- exports.ensureDir = ensureDir;
73
- exports.escapeStringRegexp = escapeStringRegexp;
74
- exports.getCacheDir = getCacheDir;
75
- exports.getGroupedEntries = getGroupedEntries;
76
- exports.pluginName = pluginName;
package/dist/utils.cjs DELETED
@@ -1,17 +0,0 @@
1
- 'use strict';
2
-
3
- require('node:fs/promises');
4
- require('node:path');
5
- require('node:process');
6
- const shared = require('@tailwindcss-mangle/shared');
7
- const utils = require('./shared/unplugin-tailwindcss-mangle.14c63525.cjs');
8
-
9
-
10
-
11
- exports.defaultMangleClassFilter = shared.defaultMangleClassFilter;
12
- exports.isMap = shared.isMap;
13
- exports.isRegexp = shared.isRegexp;
14
- exports.ensureDir = utils.ensureDir;
15
- exports.escapeStringRegexp = utils.escapeStringRegexp;
16
- exports.getCacheDir = utils.getCacheDir;
17
- exports.getGroupedEntries = utils.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,5 +0,0 @@
1
- import 'node:fs/promises';
2
- import 'node:path';
3
- import 'node:process';
4
- export { defaultMangleClassFilter, isMap, isRegexp } from '@tailwindcss-mangle/shared';
5
- export { b as ensureDir, e as escapeStringRegexp, a as getCacheDir, g as getGroupedEntries } from './shared/unplugin-tailwindcss-mangle.077d08fc.mjs';
package/dist/vite.cjs DELETED
@@ -1,16 +0,0 @@
1
- 'use strict';
2
-
3
- const index = require('./index.cjs');
4
- require('unplugin');
5
- require('node:path');
6
- require('@tailwindcss-mangle/core');
7
- require('is-css-request');
8
- require('@rollup/pluginutils');
9
- require('./shared/unplugin-tailwindcss-mangle.14c63525.cjs');
10
- require('node:fs/promises');
11
- require('node:process');
12
- require('@tailwindcss-mangle/shared');
13
-
14
- const vite = index.vite;
15
-
16
- 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 from '@tailwindcss-mangle/config';
3
-
4
- declare const _default: (options?: _tailwindcss_mangle_config.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 from '@tailwindcss-mangle/config';
3
-
4
- declare const _default: (options?: _tailwindcss_mangle_config.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 from '@tailwindcss-mangle/config';
3
-
4
- declare const _default: (options?: _tailwindcss_mangle_config.MangleUserConfig | undefined) => vite.Plugin<any> | vite.Plugin<any>[];
5
-
6
- export { _default as default };
package/dist/vite.mjs DELETED
@@ -1,14 +0,0 @@
1
- import unplugin from './index.mjs';
2
- import 'unplugin';
3
- import 'node:path';
4
- import '@tailwindcss-mangle/core';
5
- import 'is-css-request';
6
- import '@rollup/pluginutils';
7
- import './shared/unplugin-tailwindcss-mangle.077d08fc.mjs';
8
- import 'node:fs/promises';
9
- import 'node:process';
10
- import '@tailwindcss-mangle/shared';
11
-
12
- const vite = unplugin.vite;
13
-
14
- export { vite as default };
package/dist/webpack.cjs DELETED
@@ -1,16 +0,0 @@
1
- 'use strict';
2
-
3
- const index = require('./index.cjs');
4
- require('unplugin');
5
- require('node:path');
6
- require('@tailwindcss-mangle/core');
7
- require('is-css-request');
8
- require('@rollup/pluginutils');
9
- require('./shared/unplugin-tailwindcss-mangle.14c63525.cjs');
10
- require('node:fs/promises');
11
- require('node:process');
12
- require('@tailwindcss-mangle/shared');
13
-
14
- const webpack = index.webpack;
15
-
16
- module.exports = webpack;
@@ -1,6 +0,0 @@
1
- import * as webpack from 'webpack';
2
- import * as _tailwindcss_mangle_config from '@tailwindcss-mangle/config';
3
-
4
- declare const _default: (options?: _tailwindcss_mangle_config.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 from '@tailwindcss-mangle/config';
3
-
4
- declare const _default: (options?: _tailwindcss_mangle_config.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 from '@tailwindcss-mangle/config';
3
-
4
- declare const _default: (options?: _tailwindcss_mangle_config.MangleUserConfig | undefined) => webpack.WebpackPluginInstance;
5
-
6
- export { _default as default };
package/dist/webpack.mjs DELETED
@@ -1,14 +0,0 @@
1
- import unplugin from './index.mjs';
2
- import 'unplugin';
3
- import 'node:path';
4
- import '@tailwindcss-mangle/core';
5
- import 'is-css-request';
6
- import '@rollup/pluginutils';
7
- import './shared/unplugin-tailwindcss-mangle.077d08fc.mjs';
8
- import 'node:fs/promises';
9
- import 'node:process';
10
- import '@tailwindcss-mangle/shared';
11
-
12
- const webpack = unplugin.webpack;
13
-
14
- export { webpack as default };