unplugin-tailwindcss-mangle 2.2.2 → 2.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,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: _tailwindcss_mangle_config_index.MangleUserConfig) => esbuild.Plugin;
4
+ declare const _default: (options?: _tailwindcss_mangle_config_index.MangleUserConfig | undefined) => esbuild.Plugin;
5
5
 
6
6
  export { _default as default };
@@ -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: _tailwindcss_mangle_config_index.MangleUserConfig) => esbuild.Plugin;
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: _tailwindcss_mangle_config_index.MangleUserConfig) => esbuild.Plugin;
4
+ declare const _default: (options?: _tailwindcss_mangle_config_index.MangleUserConfig | undefined) => esbuild.Plugin;
5
5
 
6
6
  export { _default as default };
package/dist/index.cjs CHANGED
@@ -28,30 +28,33 @@ const unplugin = unplugin$1.createUnplugin((options) => {
28
28
  },
29
29
  transform(code, id) {
30
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
- });
31
+ if (/\.[jt]sx?$/.test(id)) {
32
+ return core.preProcessJs({
33
+ code: s,
34
+ ctx,
35
+ id
36
+ });
37
+ } else if (/\.vue/.test(id)) {
38
+ return core.vueHandler(code, {
39
+ ctx
40
+ });
41
+ } else {
42
+ return core.preProcessRawCode({
43
+ code,
44
+ ctx,
45
+ id
46
+ });
47
+ }
43
48
  },
44
49
  vite: {
45
50
  generateBundle: {
46
51
  async handler(options2, bundle) {
47
- const replaceMap = ctx.getReplaceMap();
48
52
  const groupedEntries = utils.getGroupedEntries(Object.entries(bundle));
49
53
  if (Array.isArray(groupedEntries.css) && groupedEntries.css.length > 0) {
50
54
  for (let i = 0; i < groupedEntries.css.length; i++) {
51
55
  const [file, cssSource] = groupedEntries.css[i];
52
56
  const { css } = await core.cssHandler(cssSource.source.toString(), {
53
57
  file,
54
- replaceMap,
55
58
  ctx
56
59
  });
57
60
  cssSource.source = css;
@@ -70,13 +73,11 @@ const unplugin = unplugin$1.createUnplugin((options) => {
70
73
  stage: Compilation.PROCESS_ASSETS_STAGE_SUMMARIZE
71
74
  },
72
75
  async (assets) => {
73
- const replaceMap = ctx.getReplaceMap();
74
76
  const groupedEntries = utils.getGroupedEntries(Object.entries(assets));
75
77
  if (groupedEntries.js.length > 0) {
76
78
  for (let i = 0; i < groupedEntries.js.length; i++) {
77
79
  const [file, chunk] = groupedEntries.js[i];
78
80
  const code = core.jsHandler(chunk.source().toString(), {
79
- replaceMap,
80
81
  ctx
81
82
  }).code;
82
83
  if (code) {
@@ -89,7 +90,6 @@ const unplugin = unplugin$1.createUnplugin((options) => {
89
90
  for (let i = 0; i < groupedEntries.css.length; i++) {
90
91
  const [file, cssSource] = groupedEntries.css[i];
91
92
  const { css } = await core.cssHandler(cssSource.source().toString(), {
92
- replaceMap,
93
93
  file,
94
94
  ctx
95
95
  });
@@ -101,8 +101,7 @@ const unplugin = unplugin$1.createUnplugin((options) => {
101
101
  for (let i = 0; i < groupedEntries.html.length; i++) {
102
102
  const [file, asset] = groupedEntries.html[i];
103
103
  const html = core.htmlHandler(asset.source().toString(), {
104
- ctx,
105
- replaceMap
104
+ ctx
106
105
  });
107
106
  const source = new ConcatSource(html);
108
107
  compilation.updateAsset(file, source);
package/dist/index.d.cts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as _unplugin from 'unplugin';
2
2
  import { MangleUserConfig } from '@tailwindcss-mangle/config';
3
3
 
4
- declare const unplugin: _unplugin.UnpluginInstance<MangleUserConfig, boolean>;
4
+ declare const unplugin: _unplugin.UnpluginInstance<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
2
  import { MangleUserConfig } from '@tailwindcss-mangle/config';
3
3
 
4
- declare const unplugin: _unplugin.UnpluginInstance<MangleUserConfig, boolean>;
4
+ declare const unplugin: _unplugin.UnpluginInstance<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
2
  import { MangleUserConfig } from '@tailwindcss-mangle/config';
3
3
 
4
- declare const unplugin: _unplugin.UnpluginInstance<MangleUserConfig, boolean>;
4
+ declare const unplugin: _unplugin.UnpluginInstance<MangleUserConfig | undefined, boolean>;
5
5
 
6
6
  export { unplugin as default };
package/dist/index.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  import { dirname } from 'node:path';
2
2
  import fs from 'node:fs/promises';
3
3
  import { createUnplugin } from 'unplugin';
4
- import { Context, preProcessJs, preProcessRawCode, cssHandler, jsHandler, htmlHandler } from '@tailwindcss-mangle/core';
4
+ import { Context, preProcessJs, vueHandler, preProcessRawCode, cssHandler, jsHandler, htmlHandler } from '@tailwindcss-mangle/core';
5
5
  import MagicString from 'magic-string';
6
6
  import { p as pluginName, g as getGroupedEntries, e as ensureDir } from './shared/unplugin-tailwindcss-mangle.9275c584.mjs';
7
7
  import '@tailwindcss-mangle/shared';
@@ -21,30 +21,33 @@ const unplugin = createUnplugin((options) => {
21
21
  },
22
22
  transform(code, id) {
23
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
- });
24
+ if (/\.[jt]sx?$/.test(id)) {
25
+ return preProcessJs({
26
+ code: s,
27
+ ctx,
28
+ id
29
+ });
30
+ } else if (/\.vue/.test(id)) {
31
+ return vueHandler(code, {
32
+ ctx
33
+ });
34
+ } else {
35
+ return preProcessRawCode({
36
+ code,
37
+ ctx,
38
+ id
39
+ });
40
+ }
36
41
  },
37
42
  vite: {
38
43
  generateBundle: {
39
44
  async handler(options2, bundle) {
40
- const replaceMap = ctx.getReplaceMap();
41
45
  const groupedEntries = getGroupedEntries(Object.entries(bundle));
42
46
  if (Array.isArray(groupedEntries.css) && groupedEntries.css.length > 0) {
43
47
  for (let i = 0; i < groupedEntries.css.length; i++) {
44
48
  const [file, cssSource] = groupedEntries.css[i];
45
49
  const { css } = await cssHandler(cssSource.source.toString(), {
46
50
  file,
47
- replaceMap,
48
51
  ctx
49
52
  });
50
53
  cssSource.source = css;
@@ -63,13 +66,11 @@ const unplugin = createUnplugin((options) => {
63
66
  stage: Compilation.PROCESS_ASSETS_STAGE_SUMMARIZE
64
67
  },
65
68
  async (assets) => {
66
- const replaceMap = ctx.getReplaceMap();
67
69
  const groupedEntries = getGroupedEntries(Object.entries(assets));
68
70
  if (groupedEntries.js.length > 0) {
69
71
  for (let i = 0; i < groupedEntries.js.length; i++) {
70
72
  const [file, chunk] = groupedEntries.js[i];
71
73
  const code = jsHandler(chunk.source().toString(), {
72
- replaceMap,
73
74
  ctx
74
75
  }).code;
75
76
  if (code) {
@@ -82,7 +83,6 @@ const unplugin = createUnplugin((options) => {
82
83
  for (let i = 0; i < groupedEntries.css.length; i++) {
83
84
  const [file, cssSource] = groupedEntries.css[i];
84
85
  const { css } = await cssHandler(cssSource.source().toString(), {
85
- replaceMap,
86
86
  file,
87
87
  ctx
88
88
  });
@@ -94,8 +94,7 @@ const unplugin = createUnplugin((options) => {
94
94
  for (let i = 0; i < groupedEntries.html.length; i++) {
95
95
  const [file, asset] = groupedEntries.html[i];
96
96
  const html = htmlHandler(asset.source().toString(), {
97
- ctx,
98
- replaceMap
97
+ ctx
99
98
  });
100
99
  const source = new ConcatSource(html);
101
100
  compilation.updateAsset(file, source);
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: _tailwindcss_mangle_config_index.MangleUserConfig) => rollup.Plugin<any> | rollup.Plugin<any>[];
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: _tailwindcss_mangle_config_index.MangleUserConfig) => rollup.Plugin<any> | rollup.Plugin<any>[];
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: _tailwindcss_mangle_config_index.MangleUserConfig) => rollup.Plugin<any> | rollup.Plugin<any>[];
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/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: _tailwindcss_mangle_config_index.MangleUserConfig) => vite.Plugin | vite.Plugin[];
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: _tailwindcss_mangle_config_index.MangleUserConfig) => vite.Plugin | vite.Plugin[];
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: _tailwindcss_mangle_config_index.MangleUserConfig) => vite.Plugin | vite.Plugin[];
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 };
@@ -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: _tailwindcss_mangle_config_index.MangleUserConfig) => webpack.WebpackPluginInstance;
4
+ declare const _default: (options?: _tailwindcss_mangle_config_index.MangleUserConfig | undefined) => webpack.WebpackPluginInstance;
5
5
 
6
6
  export { _default as default };
@@ -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: _tailwindcss_mangle_config_index.MangleUserConfig) => webpack.WebpackPluginInstance;
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: _tailwindcss_mangle_config_index.MangleUserConfig) => webpack.WebpackPluginInstance;
4
+ declare const _default: (options?: _tailwindcss_mangle_config_index.MangleUserConfig | undefined) => webpack.WebpackPluginInstance;
5
5
 
6
6
  export { _default as default };
package/package.json CHANGED
@@ -1,48 +1,63 @@
1
1
  {
2
2
  "name": "unplugin-tailwindcss-mangle",
3
- "version": "2.2.2",
3
+ "version": "2.3.0",
4
4
  "description": "mangle tailwindcss utilities class plugin. support vite and webpack!",
5
- "main": "./dist/index.cjs",
6
- "module": "./dist/index.mjs",
7
- "types": "./dist/index.d.ts",
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
- "require": "./dist/index.cjs",
12
- "import": "./dist/index.mjs"
23
+ "import": "./dist/index.mjs",
24
+ "require": "./dist/index.cjs"
13
25
  },
14
26
  "./vite": {
15
27
  "types": "./dist/vite.d.ts",
16
- "require": "./dist/vite.cjs",
17
- "import": "./dist/vite.mjs"
28
+ "import": "./dist/vite.mjs",
29
+ "require": "./dist/vite.cjs"
18
30
  },
19
31
  "./webpack": {
20
32
  "types": "./dist/webpack.d.ts",
21
- "require": "./dist/webpack.cjs",
22
- "import": "./dist/webpack.mjs"
33
+ "import": "./dist/webpack.mjs",
34
+ "require": "./dist/webpack.cjs"
23
35
  },
24
36
  "./rollup": {
25
37
  "types": "./dist/rollup.d.ts",
26
- "require": "./dist/rollup.cjs",
27
- "import": "./dist/rollup.mjs"
38
+ "import": "./dist/rollup.mjs",
39
+ "require": "./dist/rollup.cjs"
28
40
  },
29
41
  "./esbuild": {
30
42
  "types": "./dist/esbuild.d.ts",
31
- "require": "./dist/esbuild.cjs",
32
- "import": "./dist/esbuild.mjs"
43
+ "import": "./dist/esbuild.mjs",
44
+ "require": "./dist/esbuild.cjs"
33
45
  },
34
46
  "./nuxt": {
35
47
  "types": "./dist/nuxt.d.ts",
36
- "require": "./dist/nuxt.cjs",
37
- "import": "./dist/nuxt.mjs"
48
+ "import": "./dist/nuxt.mjs",
49
+ "require": "./dist/nuxt.cjs"
38
50
  },
39
51
  "./utils": {
40
52
  "types": "./dist/utils.d.ts",
41
- "require": "./dist/utils.cjs",
42
- "import": "./dist/utils.mjs"
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,21 +69,11 @@
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
- "magic-string": "^0.30.3",
69
- "unplugin": "^1.5.0",
73
+ "magic-string": "^0.30.10",
74
+ "unplugin": "^1.10.1",
70
75
  "@tailwindcss-mangle/config": "^2.2.2",
71
- "@tailwindcss-mangle/core": "^2.2.2",
76
+ "@tailwindcss-mangle/core": "^2.3.0",
72
77
  "@tailwindcss-mangle/shared": "^2.2.2"
73
78
  },
74
79
  "publishConfig": {
@@ -76,24 +81,19 @@
76
81
  "registry": "https://registry.npmjs.org/"
77
82
  },
78
83
  "devDependencies": {
79
- "@types/babel__helper-plugin-utils": "^7.10.1",
80
- "astro": "^2.10.12",
81
- "css-loader": "^6.8.1",
82
- "html-webpack-plugin": "^5.5.3",
83
- "mini-css-extract-plugin": "^2.7.6",
84
+ "@types/babel__helper-plugin-utils": "^7.10.3",
85
+ "astro": "^4.10.3",
86
+ "css-loader": "^7.1.2",
87
+ "html-webpack-plugin": "^5.6.0",
88
+ "mini-css-extract-plugin": "^2.9.0",
84
89
  "normalize-newline": "^4.1.0",
85
- "postcss": "^8.4.30",
86
- "postcss-loader": "^7.3.3",
87
- "tailwindcss": "^3.3.3",
88
- "vite": "^4.4.9",
89
- "webpack": "^5.88.2",
90
- "webpack-build-utils": "^0.0.4",
91
- "tailwindcss-patch": "^2.2.2"
92
- },
93
- "homepage": "https://github.com/sonofmagic/tailwindcss-mangle",
94
- "repository": {
95
- "type": "git",
96
- "url": "git+https://github.com/sonofmagic/tailwindcss-mangle.git"
90
+ "postcss": "^8.4.38",
91
+ "postcss-loader": "^8.1.1",
92
+ "tailwindcss": "^3.4.4",
93
+ "vite": "^5.3.1",
94
+ "webpack": "^5.92.0",
95
+ "webpack-build-utils": "^0.0.7",
96
+ "tailwindcss-patch": "^3.0.1"
97
97
  },
98
98
  "scripts": {
99
99
  "dev": "unbuild --sourcemap",