unplugin-tailwindcss-mangle 2.2.2 → 3.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.
- package/dist/esbuild.cjs +4 -6
- package/dist/esbuild.d.cts +1 -1
- package/dist/esbuild.d.mts +1 -1
- package/dist/esbuild.d.ts +1 -1
- package/dist/esbuild.mjs +4 -6
- package/dist/index.cjs +50 -124
- package/dist/index.d.cts +2 -2
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.mjs +51 -120
- package/dist/nuxt.cjs +4 -6
- package/dist/nuxt.mjs +4 -6
- package/dist/rollup.cjs +4 -6
- package/dist/rollup.d.cts +1 -1
- package/dist/rollup.d.mts +1 -1
- package/dist/rollup.d.ts +1 -1
- package/dist/rollup.mjs +4 -6
- package/dist/shared/unplugin-tailwindcss-mangle.462669b1.cjs +5 -0
- package/dist/shared/unplugin-tailwindcss-mangle.fdb82141.mjs +3 -0
- package/dist/utils.cjs +68 -7
- package/dist/utils.mjs +63 -3
- package/dist/vite.cjs +4 -6
- package/dist/vite.d.cts +1 -1
- package/dist/vite.d.mts +1 -1
- package/dist/vite.d.ts +1 -1
- package/dist/vite.mjs +4 -6
- package/dist/webpack.cjs +4 -6
- package/dist/webpack.d.cts +1 -1
- package/dist/webpack.d.mts +1 -1
- package/dist/webpack.d.ts +1 -1
- package/dist/webpack.mjs +4 -6
- package/package.json +52 -50
- package/dist/shared/unplugin-tailwindcss-mangle.43bd55b2.cjs +0 -74
- package/dist/shared/unplugin-tailwindcss-mangle.9275c584.mjs +0 -63
package/dist/esbuild.cjs
CHANGED
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
const index = require('./index.cjs');
|
|
4
|
-
require('node:path');
|
|
5
|
-
require('node:fs/promises');
|
|
6
|
-
require('unplugin');
|
|
7
4
|
require('@tailwindcss-mangle/core');
|
|
8
|
-
require('
|
|
9
|
-
require('
|
|
10
|
-
require('
|
|
5
|
+
require('is-css-request');
|
|
6
|
+
require('@rollup/pluginutils');
|
|
7
|
+
require('unplugin');
|
|
8
|
+
require('./shared/unplugin-tailwindcss-mangle.462669b1.cjs');
|
|
11
9
|
|
|
12
10
|
const esbuild = index.esbuild;
|
|
13
11
|
|
package/dist/esbuild.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as esbuild from 'esbuild';
|
|
2
2
|
import * as _tailwindcss_mangle_config_index from '@tailwindcss-mangle/config/index';
|
|
3
3
|
|
|
4
|
-
declare const _default: (options
|
|
4
|
+
declare const _default: (options?: _tailwindcss_mangle_config_index.MangleUserConfig | undefined) => esbuild.Plugin;
|
|
5
5
|
|
|
6
6
|
export { _default as default };
|
package/dist/esbuild.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as esbuild from 'esbuild';
|
|
2
2
|
import * as _tailwindcss_mangle_config_index from '@tailwindcss-mangle/config/index';
|
|
3
3
|
|
|
4
|
-
declare const _default: (options
|
|
4
|
+
declare const _default: (options?: _tailwindcss_mangle_config_index.MangleUserConfig | undefined) => esbuild.Plugin;
|
|
5
5
|
|
|
6
6
|
export { _default as default };
|
package/dist/esbuild.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as esbuild from 'esbuild';
|
|
2
2
|
import * as _tailwindcss_mangle_config_index from '@tailwindcss-mangle/config/index';
|
|
3
3
|
|
|
4
|
-
declare const _default: (options
|
|
4
|
+
declare const _default: (options?: _tailwindcss_mangle_config_index.MangleUserConfig | undefined) => esbuild.Plugin;
|
|
5
5
|
|
|
6
6
|
export { _default as default };
|
package/dist/esbuild.mjs
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import unplugin from './index.mjs';
|
|
2
|
-
import 'node:path';
|
|
3
|
-
import 'node:fs/promises';
|
|
4
|
-
import 'unplugin';
|
|
5
2
|
import '@tailwindcss-mangle/core';
|
|
6
|
-
import '
|
|
7
|
-
import '
|
|
8
|
-
import '
|
|
3
|
+
import 'is-css-request';
|
|
4
|
+
import '@rollup/pluginutils';
|
|
5
|
+
import 'unplugin';
|
|
6
|
+
import './shared/unplugin-tailwindcss-mangle.fdb82141.mjs';
|
|
9
7
|
|
|
10
8
|
const esbuild = unplugin.esbuild;
|
|
11
9
|
|
package/dist/index.cjs
CHANGED
|
@@ -1,140 +1,66 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const path = require('node:path');
|
|
4
|
-
const fs = require('node:fs/promises');
|
|
5
3
|
const unplugin$1 = require('unplugin');
|
|
6
4
|
const core = require('@tailwindcss-mangle/core');
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
require('
|
|
5
|
+
const isCssRequest = require('is-css-request');
|
|
6
|
+
const pluginutils = require('@rollup/pluginutils');
|
|
7
|
+
const constants = require('./shared/unplugin-tailwindcss-mangle.462669b1.cjs');
|
|
10
8
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
const fs__default = /*#__PURE__*/_interopDefaultCompat(fs);
|
|
14
|
-
const MagicString__default = /*#__PURE__*/_interopDefaultCompat(MagicString);
|
|
15
|
-
|
|
16
|
-
const unplugin = unplugin$1.createUnplugin((options) => {
|
|
9
|
+
const factory = (options) => {
|
|
17
10
|
const ctx = new core.Context();
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
transform(code, id) {
|
|
30
|
-
const s = new MagicString__default(code);
|
|
31
|
-
const replaceMap = ctx.getReplaceMap();
|
|
32
|
-
return /\.[jt]sx?$/.test(id) ? core.preProcessJs({
|
|
33
|
-
code: s,
|
|
34
|
-
replaceMap,
|
|
35
|
-
ctx,
|
|
36
|
-
id
|
|
37
|
-
}) : core.preProcessRawCode({
|
|
38
|
-
code,
|
|
39
|
-
ctx,
|
|
40
|
-
replaceMap,
|
|
41
|
-
id
|
|
42
|
-
});
|
|
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
|
+
}
|
|
43
22
|
},
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
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);
|
|
59
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);
|
|
60
45
|
}
|
|
61
46
|
}
|
|
62
47
|
},
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
{
|
|
69
|
-
|
|
70
|
-
stage: Compilation.PROCESS_ASSETS_STAGE_SUMMARIZE
|
|
71
|
-
},
|
|
72
|
-
async (assets) => {
|
|
73
|
-
const replaceMap = ctx.getReplaceMap();
|
|
74
|
-
const groupedEntries = utils.getGroupedEntries(Object.entries(assets));
|
|
75
|
-
if (groupedEntries.js.length > 0) {
|
|
76
|
-
for (let i = 0; i < groupedEntries.js.length; i++) {
|
|
77
|
-
const [file, chunk] = groupedEntries.js[i];
|
|
78
|
-
const code = core.jsHandler(chunk.source().toString(), {
|
|
79
|
-
replaceMap,
|
|
80
|
-
ctx
|
|
81
|
-
}).code;
|
|
82
|
-
if (code) {
|
|
83
|
-
const source = new ConcatSource(code);
|
|
84
|
-
compilation.updateAsset(file, source);
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
if (groupedEntries.css.length > 0) {
|
|
89
|
-
for (let i = 0; i < groupedEntries.css.length; i++) {
|
|
90
|
-
const [file, cssSource] = groupedEntries.css[i];
|
|
91
|
-
const { css } = await core.cssHandler(cssSource.source().toString(), {
|
|
92
|
-
replaceMap,
|
|
93
|
-
file,
|
|
94
|
-
ctx
|
|
95
|
-
});
|
|
96
|
-
const source = new ConcatSource(css);
|
|
97
|
-
compilation.updateAsset(file, source);
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
if (groupedEntries.html.length > 0) {
|
|
101
|
-
for (let i = 0; i < groupedEntries.html.length; i++) {
|
|
102
|
-
const [file, asset] = groupedEntries.html[i];
|
|
103
|
-
const html = core.htmlHandler(asset.source().toString(), {
|
|
104
|
-
ctx,
|
|
105
|
-
replaceMap
|
|
106
|
-
});
|
|
107
|
-
const source = new ConcatSource(html);
|
|
108
|
-
compilation.updateAsset(file, source);
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
);
|
|
113
|
-
});
|
|
114
|
-
},
|
|
115
|
-
async writeBundle() {
|
|
116
|
-
if (ctx.options.classMapOutput?.enable) {
|
|
117
|
-
const opts = ctx.options.classMapOutput;
|
|
118
|
-
const entries = Object.entries(ctx.classGenerator.newClassMap);
|
|
119
|
-
if (entries.length > 0 && opts) {
|
|
120
|
-
await utils.ensureDir(path.dirname(opts.filename));
|
|
121
|
-
const output = JSON.stringify(
|
|
122
|
-
entries.map((x) => {
|
|
123
|
-
return {
|
|
124
|
-
origin: x[0],
|
|
125
|
-
replacement: x[1].name,
|
|
126
|
-
usedBy: [...x[1].usedBy]
|
|
127
|
-
};
|
|
128
|
-
}),
|
|
129
|
-
null,
|
|
130
|
-
opts.loose ? 2 : 0
|
|
131
|
-
);
|
|
132
|
-
await fs__default.writeFile(opts.filename, output, "utf8");
|
|
133
|
-
console.log(`\u2728 ${opts.filename} generated!`);
|
|
48
|
+
{
|
|
49
|
+
name: `${constants.pluginName}:post`,
|
|
50
|
+
enforce: "post",
|
|
51
|
+
vite: {
|
|
52
|
+
transformIndexHtml(html) {
|
|
53
|
+
const { code } = core.htmlHandler(html, { ctx });
|
|
54
|
+
return code;
|
|
134
55
|
}
|
|
56
|
+
},
|
|
57
|
+
writeBundle() {
|
|
58
|
+
ctx.dump();
|
|
135
59
|
}
|
|
136
60
|
}
|
|
137
|
-
|
|
138
|
-
}
|
|
61
|
+
];
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
const unplugin = unplugin$1.createUnplugin(factory);
|
|
139
65
|
|
|
140
66
|
module.exports = unplugin;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as _unplugin from 'unplugin';
|
|
2
|
-
import
|
|
2
|
+
import * as _tailwindcss_mangle_config_index from '@tailwindcss-mangle/config/index';
|
|
3
3
|
|
|
4
|
-
declare const unplugin: _unplugin.UnpluginInstance<MangleUserConfig, boolean>;
|
|
4
|
+
declare const unplugin: _unplugin.UnpluginInstance<_tailwindcss_mangle_config_index.MangleUserConfig | undefined, boolean>;
|
|
5
5
|
|
|
6
6
|
export { unplugin as default };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as _unplugin from 'unplugin';
|
|
2
|
-
import
|
|
2
|
+
import * as _tailwindcss_mangle_config_index from '@tailwindcss-mangle/config/index';
|
|
3
3
|
|
|
4
|
-
declare const unplugin: _unplugin.UnpluginInstance<MangleUserConfig, boolean>;
|
|
4
|
+
declare const unplugin: _unplugin.UnpluginInstance<_tailwindcss_mangle_config_index.MangleUserConfig | undefined, boolean>;
|
|
5
5
|
|
|
6
6
|
export { unplugin as default };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as _unplugin from 'unplugin';
|
|
2
|
-
import
|
|
2
|
+
import * as _tailwindcss_mangle_config_index from '@tailwindcss-mangle/config/index';
|
|
3
3
|
|
|
4
|
-
declare const unplugin: _unplugin.UnpluginInstance<MangleUserConfig, boolean>;
|
|
4
|
+
declare const unplugin: _unplugin.UnpluginInstance<_tailwindcss_mangle_config_index.MangleUserConfig | undefined, boolean>;
|
|
5
5
|
|
|
6
6
|
export { unplugin as default };
|
package/dist/index.mjs
CHANGED
|
@@ -1,133 +1,64 @@
|
|
|
1
|
-
import { dirname } from 'node:path';
|
|
2
|
-
import fs from 'node:fs/promises';
|
|
3
1
|
import { createUnplugin } from 'unplugin';
|
|
4
|
-
import { Context,
|
|
5
|
-
import
|
|
6
|
-
import {
|
|
7
|
-
import '
|
|
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';
|
|
8
6
|
|
|
9
|
-
const
|
|
7
|
+
const factory = (options) => {
|
|
10
8
|
const ctx = new Context();
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
transform(code, id) {
|
|
23
|
-
const s = new MagicString(code);
|
|
24
|
-
const replaceMap = ctx.getReplaceMap();
|
|
25
|
-
return /\.[jt]sx?$/.test(id) ? preProcessJs({
|
|
26
|
-
code: s,
|
|
27
|
-
replaceMap,
|
|
28
|
-
ctx,
|
|
29
|
-
id
|
|
30
|
-
}) : preProcessRawCode({
|
|
31
|
-
code,
|
|
32
|
-
ctx,
|
|
33
|
-
replaceMap,
|
|
34
|
-
id
|
|
35
|
-
});
|
|
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
|
+
}
|
|
36
20
|
},
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
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);
|
|
52
38
|
}
|
|
39
|
+
} else if (isCSSRequest(id)) {
|
|
40
|
+
return await cssHandler(code, opts);
|
|
41
|
+
} else if (/\.html?/.test(id)) {
|
|
42
|
+
return htmlHandler(code, opts);
|
|
53
43
|
}
|
|
54
44
|
}
|
|
55
45
|
},
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
{
|
|
62
|
-
|
|
63
|
-
stage: Compilation.PROCESS_ASSETS_STAGE_SUMMARIZE
|
|
64
|
-
},
|
|
65
|
-
async (assets) => {
|
|
66
|
-
const replaceMap = ctx.getReplaceMap();
|
|
67
|
-
const groupedEntries = getGroupedEntries(Object.entries(assets));
|
|
68
|
-
if (groupedEntries.js.length > 0) {
|
|
69
|
-
for (let i = 0; i < groupedEntries.js.length; i++) {
|
|
70
|
-
const [file, chunk] = groupedEntries.js[i];
|
|
71
|
-
const code = jsHandler(chunk.source().toString(), {
|
|
72
|
-
replaceMap,
|
|
73
|
-
ctx
|
|
74
|
-
}).code;
|
|
75
|
-
if (code) {
|
|
76
|
-
const source = new ConcatSource(code);
|
|
77
|
-
compilation.updateAsset(file, source);
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
if (groupedEntries.css.length > 0) {
|
|
82
|
-
for (let i = 0; i < groupedEntries.css.length; i++) {
|
|
83
|
-
const [file, cssSource] = groupedEntries.css[i];
|
|
84
|
-
const { css } = await cssHandler(cssSource.source().toString(), {
|
|
85
|
-
replaceMap,
|
|
86
|
-
file,
|
|
87
|
-
ctx
|
|
88
|
-
});
|
|
89
|
-
const source = new ConcatSource(css);
|
|
90
|
-
compilation.updateAsset(file, source);
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
if (groupedEntries.html.length > 0) {
|
|
94
|
-
for (let i = 0; i < groupedEntries.html.length; i++) {
|
|
95
|
-
const [file, asset] = groupedEntries.html[i];
|
|
96
|
-
const html = htmlHandler(asset.source().toString(), {
|
|
97
|
-
ctx,
|
|
98
|
-
replaceMap
|
|
99
|
-
});
|
|
100
|
-
const source = new ConcatSource(html);
|
|
101
|
-
compilation.updateAsset(file, source);
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
);
|
|
106
|
-
});
|
|
107
|
-
},
|
|
108
|
-
async writeBundle() {
|
|
109
|
-
if (ctx.options.classMapOutput?.enable) {
|
|
110
|
-
const opts = ctx.options.classMapOutput;
|
|
111
|
-
const entries = Object.entries(ctx.classGenerator.newClassMap);
|
|
112
|
-
if (entries.length > 0 && opts) {
|
|
113
|
-
await ensureDir(dirname(opts.filename));
|
|
114
|
-
const output = JSON.stringify(
|
|
115
|
-
entries.map((x) => {
|
|
116
|
-
return {
|
|
117
|
-
origin: x[0],
|
|
118
|
-
replacement: x[1].name,
|
|
119
|
-
usedBy: [...x[1].usedBy]
|
|
120
|
-
};
|
|
121
|
-
}),
|
|
122
|
-
null,
|
|
123
|
-
opts.loose ? 2 : 0
|
|
124
|
-
);
|
|
125
|
-
await fs.writeFile(opts.filename, output, "utf8");
|
|
126
|
-
console.log(`\u2728 ${opts.filename} generated!`);
|
|
46
|
+
{
|
|
47
|
+
name: `${pluginName}:post`,
|
|
48
|
+
enforce: "post",
|
|
49
|
+
vite: {
|
|
50
|
+
transformIndexHtml(html) {
|
|
51
|
+
const { code } = htmlHandler(html, { ctx });
|
|
52
|
+
return code;
|
|
127
53
|
}
|
|
54
|
+
},
|
|
55
|
+
writeBundle() {
|
|
56
|
+
ctx.dump();
|
|
128
57
|
}
|
|
129
58
|
}
|
|
130
|
-
|
|
131
|
-
}
|
|
59
|
+
];
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
const unplugin = createUnplugin(factory);
|
|
132
63
|
|
|
133
64
|
export { unplugin as default };
|
package/dist/nuxt.cjs
CHANGED
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
const index = require('./index.cjs');
|
|
4
|
-
require('node:path');
|
|
5
|
-
require('node:fs/promises');
|
|
6
|
-
require('unplugin');
|
|
7
4
|
require('@tailwindcss-mangle/core');
|
|
8
|
-
require('
|
|
9
|
-
require('
|
|
10
|
-
require('
|
|
5
|
+
require('is-css-request');
|
|
6
|
+
require('@rollup/pluginutils');
|
|
7
|
+
require('unplugin');
|
|
8
|
+
require('./shared/unplugin-tailwindcss-mangle.462669b1.cjs');
|
|
11
9
|
|
|
12
10
|
function nuxt(options = {}, nuxt) {
|
|
13
11
|
nuxt.hook("webpack:config", (config) => {
|
package/dist/nuxt.mjs
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import unplugin from './index.mjs';
|
|
2
|
-
import 'node:path';
|
|
3
|
-
import 'node:fs/promises';
|
|
4
|
-
import 'unplugin';
|
|
5
2
|
import '@tailwindcss-mangle/core';
|
|
6
|
-
import '
|
|
7
|
-
import '
|
|
8
|
-
import '
|
|
3
|
+
import 'is-css-request';
|
|
4
|
+
import '@rollup/pluginutils';
|
|
5
|
+
import 'unplugin';
|
|
6
|
+
import './shared/unplugin-tailwindcss-mangle.fdb82141.mjs';
|
|
9
7
|
|
|
10
8
|
function nuxt(options = {}, nuxt) {
|
|
11
9
|
nuxt.hook("webpack:config", (config) => {
|
package/dist/rollup.cjs
CHANGED
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
const index = require('./index.cjs');
|
|
4
|
-
require('node:path');
|
|
5
|
-
require('node:fs/promises');
|
|
6
|
-
require('unplugin');
|
|
7
4
|
require('@tailwindcss-mangle/core');
|
|
8
|
-
require('
|
|
9
|
-
require('
|
|
10
|
-
require('
|
|
5
|
+
require('is-css-request');
|
|
6
|
+
require('@rollup/pluginutils');
|
|
7
|
+
require('unplugin');
|
|
8
|
+
require('./shared/unplugin-tailwindcss-mangle.462669b1.cjs');
|
|
11
9
|
|
|
12
10
|
const rollup = index.rollup;
|
|
13
11
|
|
package/dist/rollup.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as rollup from 'rollup';
|
|
2
2
|
import * as _tailwindcss_mangle_config_index from '@tailwindcss-mangle/config/index';
|
|
3
3
|
|
|
4
|
-
declare const _default: (options
|
|
4
|
+
declare const _default: (options?: _tailwindcss_mangle_config_index.MangleUserConfig | undefined) => rollup.Plugin<any> | rollup.Plugin<any>[];
|
|
5
5
|
|
|
6
6
|
export { _default as default };
|
package/dist/rollup.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as rollup from 'rollup';
|
|
2
2
|
import * as _tailwindcss_mangle_config_index from '@tailwindcss-mangle/config/index';
|
|
3
3
|
|
|
4
|
-
declare const _default: (options
|
|
4
|
+
declare const _default: (options?: _tailwindcss_mangle_config_index.MangleUserConfig | undefined) => rollup.Plugin<any> | rollup.Plugin<any>[];
|
|
5
5
|
|
|
6
6
|
export { _default as default };
|
package/dist/rollup.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as rollup from 'rollup';
|
|
2
2
|
import * as _tailwindcss_mangle_config_index from '@tailwindcss-mangle/config/index';
|
|
3
3
|
|
|
4
|
-
declare const _default: (options
|
|
4
|
+
declare const _default: (options?: _tailwindcss_mangle_config_index.MangleUserConfig | undefined) => rollup.Plugin<any> | rollup.Plugin<any>[];
|
|
5
5
|
|
|
6
6
|
export { _default as default };
|
package/dist/rollup.mjs
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import unplugin from './index.mjs';
|
|
2
|
-
import 'node:path';
|
|
3
|
-
import 'node:fs/promises';
|
|
4
|
-
import 'unplugin';
|
|
5
2
|
import '@tailwindcss-mangle/core';
|
|
6
|
-
import '
|
|
7
|
-
import '
|
|
8
|
-
import '
|
|
3
|
+
import 'is-css-request';
|
|
4
|
+
import '@rollup/pluginutils';
|
|
5
|
+
import 'unplugin';
|
|
6
|
+
import './shared/unplugin-tailwindcss-mangle.fdb82141.mjs';
|
|
9
7
|
|
|
10
8
|
const rollup = unplugin.rollup;
|
|
11
9
|
|
package/dist/utils.cjs
CHANGED
|
@@ -1,16 +1,77 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
require('node:fs/promises');
|
|
4
|
-
require('node:path');
|
|
3
|
+
const fs = require('node:fs/promises');
|
|
4
|
+
const path = require('node:path');
|
|
5
|
+
const process = require('node:process');
|
|
5
6
|
const shared = require('@tailwindcss-mangle/shared');
|
|
6
|
-
const
|
|
7
|
+
const constants = require('./shared/unplugin-tailwindcss-mangle.462669b1.cjs');
|
|
7
8
|
|
|
9
|
+
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e.default : e; }
|
|
8
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
|
+
}
|
|
9
70
|
|
|
10
71
|
exports.defaultMangleClassFilter = shared.defaultMangleClassFilter;
|
|
11
72
|
exports.isMap = shared.isMap;
|
|
12
73
|
exports.isRegexp = shared.isRegexp;
|
|
13
|
-
exports.ensureDir =
|
|
14
|
-
exports.escapeStringRegexp =
|
|
15
|
-
exports.getCacheDir =
|
|
16
|
-
exports.getGroupedEntries =
|
|
74
|
+
exports.ensureDir = ensureDir;
|
|
75
|
+
exports.escapeStringRegexp = escapeStringRegexp;
|
|
76
|
+
exports.getCacheDir = getCacheDir;
|
|
77
|
+
exports.getGroupedEntries = getGroupedEntries;
|
package/dist/utils.mjs
CHANGED
|
@@ -1,4 +1,64 @@
|
|
|
1
|
-
import 'node:fs/promises';
|
|
2
|
-
import 'node:path';
|
|
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';
|
|
3
5
|
export { defaultMangleClassFilter, isMap, isRegexp } from '@tailwindcss-mangle/shared';
|
|
4
|
-
|
|
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
CHANGED
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
const index = require('./index.cjs');
|
|
4
|
-
require('node:path');
|
|
5
|
-
require('node:fs/promises');
|
|
6
|
-
require('unplugin');
|
|
7
4
|
require('@tailwindcss-mangle/core');
|
|
8
|
-
require('
|
|
9
|
-
require('
|
|
10
|
-
require('
|
|
5
|
+
require('is-css-request');
|
|
6
|
+
require('@rollup/pluginutils');
|
|
7
|
+
require('unplugin');
|
|
8
|
+
require('./shared/unplugin-tailwindcss-mangle.462669b1.cjs');
|
|
11
9
|
|
|
12
10
|
const vite = index.vite;
|
|
13
11
|
|
package/dist/vite.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as vite from 'vite';
|
|
2
2
|
import * as _tailwindcss_mangle_config_index from '@tailwindcss-mangle/config/index';
|
|
3
3
|
|
|
4
|
-
declare const _default: (options
|
|
4
|
+
declare const _default: (options?: _tailwindcss_mangle_config_index.MangleUserConfig | undefined) => vite.Plugin<any> | vite.Plugin<any>[];
|
|
5
5
|
|
|
6
6
|
export { _default as default };
|
package/dist/vite.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as vite from 'vite';
|
|
2
2
|
import * as _tailwindcss_mangle_config_index from '@tailwindcss-mangle/config/index';
|
|
3
3
|
|
|
4
|
-
declare const _default: (options
|
|
4
|
+
declare const _default: (options?: _tailwindcss_mangle_config_index.MangleUserConfig | undefined) => vite.Plugin<any> | vite.Plugin<any>[];
|
|
5
5
|
|
|
6
6
|
export { _default as default };
|
package/dist/vite.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as vite from 'vite';
|
|
2
2
|
import * as _tailwindcss_mangle_config_index from '@tailwindcss-mangle/config/index';
|
|
3
3
|
|
|
4
|
-
declare const _default: (options
|
|
4
|
+
declare const _default: (options?: _tailwindcss_mangle_config_index.MangleUserConfig | undefined) => vite.Plugin<any> | vite.Plugin<any>[];
|
|
5
5
|
|
|
6
6
|
export { _default as default };
|
package/dist/vite.mjs
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import unplugin from './index.mjs';
|
|
2
|
-
import 'node:path';
|
|
3
|
-
import 'node:fs/promises';
|
|
4
|
-
import 'unplugin';
|
|
5
2
|
import '@tailwindcss-mangle/core';
|
|
6
|
-
import '
|
|
7
|
-
import '
|
|
8
|
-
import '
|
|
3
|
+
import 'is-css-request';
|
|
4
|
+
import '@rollup/pluginutils';
|
|
5
|
+
import 'unplugin';
|
|
6
|
+
import './shared/unplugin-tailwindcss-mangle.fdb82141.mjs';
|
|
9
7
|
|
|
10
8
|
const vite = unplugin.vite;
|
|
11
9
|
|
package/dist/webpack.cjs
CHANGED
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
const index = require('./index.cjs');
|
|
4
|
-
require('node:path');
|
|
5
|
-
require('node:fs/promises');
|
|
6
|
-
require('unplugin');
|
|
7
4
|
require('@tailwindcss-mangle/core');
|
|
8
|
-
require('
|
|
9
|
-
require('
|
|
10
|
-
require('
|
|
5
|
+
require('is-css-request');
|
|
6
|
+
require('@rollup/pluginutils');
|
|
7
|
+
require('unplugin');
|
|
8
|
+
require('./shared/unplugin-tailwindcss-mangle.462669b1.cjs');
|
|
11
9
|
|
|
12
10
|
const webpack = index.webpack;
|
|
13
11
|
|
package/dist/webpack.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as webpack from 'webpack';
|
|
2
2
|
import * as _tailwindcss_mangle_config_index from '@tailwindcss-mangle/config/index';
|
|
3
3
|
|
|
4
|
-
declare const _default: (options
|
|
4
|
+
declare const _default: (options?: _tailwindcss_mangle_config_index.MangleUserConfig | undefined) => webpack.WebpackPluginInstance;
|
|
5
5
|
|
|
6
6
|
export { _default as default };
|
package/dist/webpack.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as webpack from 'webpack';
|
|
2
2
|
import * as _tailwindcss_mangle_config_index from '@tailwindcss-mangle/config/index';
|
|
3
3
|
|
|
4
|
-
declare const _default: (options
|
|
4
|
+
declare const _default: (options?: _tailwindcss_mangle_config_index.MangleUserConfig | undefined) => webpack.WebpackPluginInstance;
|
|
5
5
|
|
|
6
6
|
export { _default as default };
|
package/dist/webpack.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as webpack from 'webpack';
|
|
2
2
|
import * as _tailwindcss_mangle_config_index from '@tailwindcss-mangle/config/index';
|
|
3
3
|
|
|
4
|
-
declare const _default: (options
|
|
4
|
+
declare const _default: (options?: _tailwindcss_mangle_config_index.MangleUserConfig | undefined) => webpack.WebpackPluginInstance;
|
|
5
5
|
|
|
6
6
|
export { _default as default };
|
package/dist/webpack.mjs
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import unplugin from './index.mjs';
|
|
2
|
-
import 'node:path';
|
|
3
|
-
import 'node:fs/promises';
|
|
4
|
-
import 'unplugin';
|
|
5
2
|
import '@tailwindcss-mangle/core';
|
|
6
|
-
import '
|
|
7
|
-
import '
|
|
8
|
-
import '
|
|
3
|
+
import 'is-css-request';
|
|
4
|
+
import '@rollup/pluginutils';
|
|
5
|
+
import 'unplugin';
|
|
6
|
+
import './shared/unplugin-tailwindcss-mangle.fdb82141.mjs';
|
|
9
7
|
|
|
10
8
|
const webpack = unplugin.webpack;
|
|
11
9
|
|
package/package.json
CHANGED
|
@@ -1,48 +1,63 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "unplugin-tailwindcss-mangle",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0",
|
|
4
4
|
"description": "mangle tailwindcss utilities class plugin. support vite and webpack!",
|
|
5
|
-
"
|
|
6
|
-
"
|
|
7
|
-
"
|
|
5
|
+
"author": "SonOfMagic <qq1324318532@gmail.com>",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"homepage": "https://github.com/sonofmagic/tailwindcss-mangle",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "git+https://github.com/sonofmagic/tailwindcss-mangle.git"
|
|
11
|
+
},
|
|
12
|
+
"keywords": [
|
|
13
|
+
"tailwindcss",
|
|
14
|
+
"utilities",
|
|
15
|
+
"mangle",
|
|
16
|
+
"class",
|
|
17
|
+
"obfuscator",
|
|
18
|
+
"obfuscation"
|
|
19
|
+
],
|
|
8
20
|
"exports": {
|
|
9
21
|
".": {
|
|
10
22
|
"types": "./dist/index.d.ts",
|
|
11
|
-
"
|
|
12
|
-
"
|
|
23
|
+
"import": "./dist/index.mjs",
|
|
24
|
+
"require": "./dist/index.cjs"
|
|
13
25
|
},
|
|
14
26
|
"./vite": {
|
|
15
27
|
"types": "./dist/vite.d.ts",
|
|
16
|
-
"
|
|
17
|
-
"
|
|
28
|
+
"import": "./dist/vite.mjs",
|
|
29
|
+
"require": "./dist/vite.cjs"
|
|
18
30
|
},
|
|
19
31
|
"./webpack": {
|
|
20
32
|
"types": "./dist/webpack.d.ts",
|
|
21
|
-
"
|
|
22
|
-
"
|
|
33
|
+
"import": "./dist/webpack.mjs",
|
|
34
|
+
"require": "./dist/webpack.cjs"
|
|
23
35
|
},
|
|
24
36
|
"./rollup": {
|
|
25
37
|
"types": "./dist/rollup.d.ts",
|
|
26
|
-
"
|
|
27
|
-
"
|
|
38
|
+
"import": "./dist/rollup.mjs",
|
|
39
|
+
"require": "./dist/rollup.cjs"
|
|
28
40
|
},
|
|
29
41
|
"./esbuild": {
|
|
30
42
|
"types": "./dist/esbuild.d.ts",
|
|
31
|
-
"
|
|
32
|
-
"
|
|
43
|
+
"import": "./dist/esbuild.mjs",
|
|
44
|
+
"require": "./dist/esbuild.cjs"
|
|
33
45
|
},
|
|
34
46
|
"./nuxt": {
|
|
35
47
|
"types": "./dist/nuxt.d.ts",
|
|
36
|
-
"
|
|
37
|
-
"
|
|
48
|
+
"import": "./dist/nuxt.mjs",
|
|
49
|
+
"require": "./dist/nuxt.cjs"
|
|
38
50
|
},
|
|
39
51
|
"./utils": {
|
|
40
52
|
"types": "./dist/utils.d.ts",
|
|
41
|
-
"
|
|
42
|
-
"
|
|
53
|
+
"import": "./dist/utils.mjs",
|
|
54
|
+
"require": "./dist/utils.cjs"
|
|
43
55
|
},
|
|
44
56
|
"./*": "./*"
|
|
45
57
|
},
|
|
58
|
+
"main": "./dist/index.cjs",
|
|
59
|
+
"module": "./dist/index.mjs",
|
|
60
|
+
"types": "./dist/index.d.ts",
|
|
46
61
|
"typesVersions": {
|
|
47
62
|
"*": {
|
|
48
63
|
"*": [
|
|
@@ -54,46 +69,33 @@
|
|
|
54
69
|
"files": [
|
|
55
70
|
"dist"
|
|
56
71
|
],
|
|
57
|
-
"keywords": [
|
|
58
|
-
"tailwindcss",
|
|
59
|
-
"utilities",
|
|
60
|
-
"mangle",
|
|
61
|
-
"class",
|
|
62
|
-
"obfuscator",
|
|
63
|
-
"obfuscation"
|
|
64
|
-
],
|
|
65
|
-
"author": "SonOfMagic <qq1324318532@gmail.com>",
|
|
66
|
-
"license": "MIT",
|
|
67
72
|
"dependencies": {
|
|
68
|
-
"
|
|
69
|
-
"
|
|
70
|
-
"
|
|
71
|
-
"
|
|
72
|
-
"@tailwindcss-mangle/
|
|
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"
|
|
73
80
|
},
|
|
74
81
|
"publishConfig": {
|
|
75
82
|
"access": "public",
|
|
76
83
|
"registry": "https://registry.npmjs.org/"
|
|
77
84
|
},
|
|
78
85
|
"devDependencies": {
|
|
79
|
-
"@types/babel__helper-plugin-utils": "^7.10.
|
|
80
|
-
"astro": "^
|
|
81
|
-
"css-loader": "^
|
|
82
|
-
"html-webpack-plugin": "^5.
|
|
83
|
-
"mini-css-extract-plugin": "^2.
|
|
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",
|
|
84
91
|
"normalize-newline": "^4.1.0",
|
|
85
|
-
"postcss": "^8.4.
|
|
86
|
-
"postcss-loader": "^
|
|
87
|
-
"tailwindcss": "^3.
|
|
88
|
-
"vite": "^
|
|
89
|
-
"webpack": "^5.
|
|
90
|
-
"webpack-build-utils": "^0.0.
|
|
91
|
-
"tailwindcss-patch": "^
|
|
92
|
-
},
|
|
93
|
-
"homepage": "https://github.com/sonofmagic/tailwindcss-mangle",
|
|
94
|
-
"repository": {
|
|
95
|
-
"type": "git",
|
|
96
|
-
"url": "git+https://github.com/sonofmagic/tailwindcss-mangle.git"
|
|
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"
|
|
97
99
|
},
|
|
98
100
|
"scripts": {
|
|
99
101
|
"dev": "unbuild --sourcemap",
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
const fs = require('node:fs/promises');
|
|
4
|
-
const path = require('node:path');
|
|
5
|
-
const shared = require('@tailwindcss-mangle/shared');
|
|
6
|
-
|
|
7
|
-
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e.default : e; }
|
|
8
|
-
|
|
9
|
-
const fs__default = /*#__PURE__*/_interopDefaultCompat(fs);
|
|
10
|
-
const path__default = /*#__PURE__*/_interopDefaultCompat(path);
|
|
11
|
-
|
|
12
|
-
const pluginName = "unplugin-tailwindcss-mangle";
|
|
13
|
-
|
|
14
|
-
function escapeStringRegexp(str) {
|
|
15
|
-
if (typeof str !== "string") {
|
|
16
|
-
throw new TypeError("Expected a string");
|
|
17
|
-
}
|
|
18
|
-
return str.replaceAll(/[$()*+.?[\\\]^{|}]/g, "\\$&").replaceAll("-", "\\x2d");
|
|
19
|
-
}
|
|
20
|
-
function getGroupedEntries(entries, options = {
|
|
21
|
-
cssMatcher(file) {
|
|
22
|
-
return /\.css$/.test(file);
|
|
23
|
-
},
|
|
24
|
-
htmlMatcher(file) {
|
|
25
|
-
return /\.html?$/.test(file);
|
|
26
|
-
},
|
|
27
|
-
jsMatcher(file) {
|
|
28
|
-
return /\.[cm]?js$/.test(file);
|
|
29
|
-
}
|
|
30
|
-
}) {
|
|
31
|
-
const { cssMatcher, htmlMatcher, jsMatcher } = options;
|
|
32
|
-
const groupedEntries = shared.groupBy(entries, ([file]) => {
|
|
33
|
-
if (cssMatcher(file)) {
|
|
34
|
-
return "css";
|
|
35
|
-
} else if (htmlMatcher(file)) {
|
|
36
|
-
return "html";
|
|
37
|
-
} else if (jsMatcher(file)) {
|
|
38
|
-
return "js";
|
|
39
|
-
} else {
|
|
40
|
-
return "other";
|
|
41
|
-
}
|
|
42
|
-
});
|
|
43
|
-
if (!groupedEntries.css) {
|
|
44
|
-
groupedEntries.css = [];
|
|
45
|
-
}
|
|
46
|
-
if (!groupedEntries.html) {
|
|
47
|
-
groupedEntries.html = [];
|
|
48
|
-
}
|
|
49
|
-
if (!groupedEntries.js) {
|
|
50
|
-
groupedEntries.js = [];
|
|
51
|
-
}
|
|
52
|
-
if (!groupedEntries.other) {
|
|
53
|
-
groupedEntries.other = [];
|
|
54
|
-
}
|
|
55
|
-
return groupedEntries;
|
|
56
|
-
}
|
|
57
|
-
function getCacheDir(basedir = process.cwd()) {
|
|
58
|
-
return path__default.resolve(basedir, "node_modules/.cache", pluginName);
|
|
59
|
-
}
|
|
60
|
-
async function ensureDir(p) {
|
|
61
|
-
try {
|
|
62
|
-
await fs__default.access(p);
|
|
63
|
-
} catch {
|
|
64
|
-
await fs__default.mkdir(p, {
|
|
65
|
-
recursive: true
|
|
66
|
-
});
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
exports.ensureDir = ensureDir;
|
|
71
|
-
exports.escapeStringRegexp = escapeStringRegexp;
|
|
72
|
-
exports.getCacheDir = getCacheDir;
|
|
73
|
-
exports.getGroupedEntries = getGroupedEntries;
|
|
74
|
-
exports.pluginName = pluginName;
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import fs from 'node:fs/promises';
|
|
2
|
-
import path from 'node:path';
|
|
3
|
-
import { groupBy } from '@tailwindcss-mangle/shared';
|
|
4
|
-
|
|
5
|
-
const pluginName = "unplugin-tailwindcss-mangle";
|
|
6
|
-
|
|
7
|
-
function escapeStringRegexp(str) {
|
|
8
|
-
if (typeof str !== "string") {
|
|
9
|
-
throw new TypeError("Expected a string");
|
|
10
|
-
}
|
|
11
|
-
return str.replaceAll(/[$()*+.?[\\\]^{|}]/g, "\\$&").replaceAll("-", "\\x2d");
|
|
12
|
-
}
|
|
13
|
-
function getGroupedEntries(entries, options = {
|
|
14
|
-
cssMatcher(file) {
|
|
15
|
-
return /\.css$/.test(file);
|
|
16
|
-
},
|
|
17
|
-
htmlMatcher(file) {
|
|
18
|
-
return /\.html?$/.test(file);
|
|
19
|
-
},
|
|
20
|
-
jsMatcher(file) {
|
|
21
|
-
return /\.[cm]?js$/.test(file);
|
|
22
|
-
}
|
|
23
|
-
}) {
|
|
24
|
-
const { cssMatcher, htmlMatcher, jsMatcher } = options;
|
|
25
|
-
const groupedEntries = groupBy(entries, ([file]) => {
|
|
26
|
-
if (cssMatcher(file)) {
|
|
27
|
-
return "css";
|
|
28
|
-
} else if (htmlMatcher(file)) {
|
|
29
|
-
return "html";
|
|
30
|
-
} else if (jsMatcher(file)) {
|
|
31
|
-
return "js";
|
|
32
|
-
} else {
|
|
33
|
-
return "other";
|
|
34
|
-
}
|
|
35
|
-
});
|
|
36
|
-
if (!groupedEntries.css) {
|
|
37
|
-
groupedEntries.css = [];
|
|
38
|
-
}
|
|
39
|
-
if (!groupedEntries.html) {
|
|
40
|
-
groupedEntries.html = [];
|
|
41
|
-
}
|
|
42
|
-
if (!groupedEntries.js) {
|
|
43
|
-
groupedEntries.js = [];
|
|
44
|
-
}
|
|
45
|
-
if (!groupedEntries.other) {
|
|
46
|
-
groupedEntries.other = [];
|
|
47
|
-
}
|
|
48
|
-
return groupedEntries;
|
|
49
|
-
}
|
|
50
|
-
function getCacheDir(basedir = process.cwd()) {
|
|
51
|
-
return path.resolve(basedir, "node_modules/.cache", pluginName);
|
|
52
|
-
}
|
|
53
|
-
async function ensureDir(p) {
|
|
54
|
-
try {
|
|
55
|
-
await fs.access(p);
|
|
56
|
-
} catch {
|
|
57
|
-
await fs.mkdir(p, {
|
|
58
|
-
recursive: true
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
export { escapeStringRegexp as a, getCacheDir as b, ensureDir as e, getGroupedEntries as g, pluginName as p };
|