@tailwindcss-mangle/config 3.0.0 → 4.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/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/package.json CHANGED
@@ -1,13 +1,18 @@
1
1
  {
2
2
  "name": "@tailwindcss-mangle/config",
3
- "version": "3.0.0",
3
+ "type": "module",
4
+ "version": "4.0.0",
4
5
  "description": "The config and load function of tailwindcss-mangle",
5
- "author": "SonOfMagic <qq1324318532@gmail.com>",
6
+ "author": "ice breaker <1324318532@qq.com>",
6
7
  "license": "MIT",
7
- "homepage": "https://github.com/sonofmagic/tailwindcss-mangle",
8
+ "homepage": "https://mangle.icebreaker.top/",
8
9
  "repository": {
9
10
  "type": "git",
10
- "url": "git+https://github.com/sonofmagic/tailwindcss-mangle.git"
11
+ "url": "git+https://github.com/sonofmagic/tailwindcss-mangle.git",
12
+ "directory": "packages/config"
13
+ },
14
+ "bugs": {
15
+ "url": "https://github.com/sonofmagic/tailwindcss-mangle/issues"
11
16
  },
12
17
  "keywords": [
13
18
  "tailwindcss",
@@ -21,12 +26,12 @@
21
26
  "exports": {
22
27
  ".": {
23
28
  "types": "./dist/index.d.ts",
24
- "import": "./dist/index.mjs",
29
+ "import": "./dist/index.js",
25
30
  "require": "./dist/index.cjs"
26
31
  }
27
32
  },
28
33
  "main": "./dist/index.cjs",
29
- "module": "./dist/index.mjs",
34
+ "module": "./dist/index.js",
30
35
  "types": "./dist/index.d.ts",
31
36
  "typesVersions": {
32
37
  "*": {
@@ -44,13 +49,15 @@
44
49
  "registry": "https://registry.npmjs.org/"
45
50
  },
46
51
  "dependencies": {
47
- "c12": "^1.11.1",
52
+ "c12": "^2.0.1",
53
+ "fs-extra": "^11.2.0",
48
54
  "is-css-request": "^1.0.1",
49
- "@tailwindcss-mangle/shared": "^3.0.0"
55
+ "pathe": "^1.1.2",
56
+ "@tailwindcss-mangle/shared": "^4.0.0"
50
57
  },
51
58
  "scripts": {
52
- "dev": "unbuild --sourcemap",
53
- "build": "unbuild",
59
+ "dev": "tsup --watch --sourcemap",
60
+ "build": "tsup",
54
61
  "test": "vitest run --coverage.enabled",
55
62
  "test:dev": "vitest"
56
63
  }
package/dist/index.cjs DELETED
@@ -1,79 +0,0 @@
1
- 'use strict';
2
-
3
- const path = require('node:path');
4
- const fs = require('node:fs/promises');
5
- const c12 = require('c12');
6
- const process = require('node:process');
7
- const shared = require('@tailwindcss-mangle/shared');
8
- const isCssRequest = require('is-css-request');
9
-
10
- function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e.default : e; }
11
-
12
- const path__default = /*#__PURE__*/_interopDefaultCompat(path);
13
- const fs__default = /*#__PURE__*/_interopDefaultCompat(fs);
14
- const process__default = /*#__PURE__*/_interopDefaultCompat(process);
15
-
16
- const defaultPipelineInclude = ["**/*.{html,js,ts,jsx,tsx,vue,svelte,astro,elm,php,phtml,mdx,md}", isCssRequest.CSS_LANGS_RE];
17
- const defaultPipelineExclude = [/[\\/](node_modules|dist|\.temp|\.cache|\.vscode)[\\/]/];
18
- function getDefaultPatchConfig() {
19
- return {
20
- output: {
21
- filename: ".tw-patch/tw-class-list.json",
22
- removeUniversalSelector: true,
23
- loose: true
24
- },
25
- tailwindcss: {}
26
- };
27
- }
28
- function getDefaultMangleUserConfig() {
29
- return {
30
- mangleClassFilter: shared.defaultMangleClassFilter,
31
- include: defaultPipelineInclude,
32
- exclude: defaultPipelineExclude,
33
- disabled: process__default.env.NODE_ENV === "development",
34
- classListPath: ".tw-patch/tw-class-list.json",
35
- classMapOutput: {
36
- enable: false,
37
- filename: ".tw-patch/tw-map-list.json",
38
- loose: true
39
- },
40
- preserveFunction: []
41
- };
42
- }
43
- function getDefaultUserConfig() {
44
- return {
45
- patch: getDefaultPatchConfig(),
46
- mangle: getDefaultMangleUserConfig()
47
- };
48
- }
49
-
50
- const configName = "tailwindcss-mangle";
51
-
52
- function getConfig(cwd) {
53
- return c12.loadConfig({
54
- name: configName,
55
- defaults: {
56
- ...getDefaultUserConfig()
57
- },
58
- cwd
59
- });
60
- }
61
- const defineConfig = c12.createDefineConfig();
62
- function initConfig(cwd) {
63
- return fs__default.writeFile(
64
- path__default.resolve(cwd, `${configName}.config.ts`),
65
- `import { defineConfig } from 'tailwindcss-patch'
66
-
67
- export default defineConfig({})
68
- `,
69
- "utf8"
70
- );
71
- }
72
-
73
- exports.configName = configName;
74
- exports.defineConfig = defineConfig;
75
- exports.getConfig = getConfig;
76
- exports.getDefaultMangleUserConfig = getDefaultMangleUserConfig;
77
- exports.getDefaultPatchConfig = getDefaultPatchConfig;
78
- exports.getDefaultUserConfig = getDefaultUserConfig;
79
- exports.initConfig = initConfig;
package/dist/index.d.cts DELETED
@@ -1,54 +0,0 @@
1
- import * as c12 from 'c12';
2
- import { IClassGeneratorOptions } from '@tailwindcss-mangle/shared';
3
- import { FilterPattern } from '@rollup/pluginutils';
4
-
5
- interface ClassMapOutputOptions {
6
- enable?: boolean;
7
- filename?: string;
8
- loose?: boolean;
9
- }
10
- interface ClassMapOutputItem {
11
- before: string;
12
- after: string;
13
- usedBy: string[];
14
- }
15
- interface MangleUserConfig {
16
- mangleClassFilter?: (className: string) => boolean;
17
- classGenerator?: IClassGeneratorOptions;
18
- exclude?: FilterPattern;
19
- include?: FilterPattern;
20
- classListPath?: string;
21
- classMapOutput?: boolean | ClassMapOutputOptions | ((json: ClassMapOutputItem[]) => void);
22
- disabled?: boolean;
23
- preserveFunction?: string[];
24
- }
25
- interface PatchUserConfig {
26
- output?: {
27
- filename?: string;
28
- loose?: boolean;
29
- /**
30
- * @description remove * in output json
31
- */
32
- removeUniversalSelector?: boolean;
33
- };
34
- tailwindcss?: {
35
- cwd?: string;
36
- config?: string;
37
- };
38
- }
39
- interface UserConfig {
40
- patch?: PatchUserConfig;
41
- mangle?: MangleUserConfig;
42
- }
43
-
44
- declare function getConfig(cwd?: string): Promise<c12.ResolvedConfig<UserConfig, c12.ConfigLayerMeta>>;
45
- declare const defineConfig: c12.DefineConfig<UserConfig, c12.ConfigLayerMeta>;
46
- declare function initConfig(cwd: string): Promise<void>;
47
-
48
- declare function getDefaultPatchConfig(): PatchUserConfig;
49
- declare function getDefaultMangleUserConfig(): MangleUserConfig;
50
- declare function getDefaultUserConfig(): UserConfig;
51
-
52
- declare const configName = "tailwindcss-mangle";
53
-
54
- export { type ClassMapOutputItem, type ClassMapOutputOptions, type MangleUserConfig, type PatchUserConfig, type UserConfig, configName, defineConfig, getConfig, getDefaultMangleUserConfig, getDefaultPatchConfig, getDefaultUserConfig, initConfig };
package/dist/index.d.mts DELETED
@@ -1,54 +0,0 @@
1
- import * as c12 from 'c12';
2
- import { IClassGeneratorOptions } from '@tailwindcss-mangle/shared';
3
- import { FilterPattern } from '@rollup/pluginutils';
4
-
5
- interface ClassMapOutputOptions {
6
- enable?: boolean;
7
- filename?: string;
8
- loose?: boolean;
9
- }
10
- interface ClassMapOutputItem {
11
- before: string;
12
- after: string;
13
- usedBy: string[];
14
- }
15
- interface MangleUserConfig {
16
- mangleClassFilter?: (className: string) => boolean;
17
- classGenerator?: IClassGeneratorOptions;
18
- exclude?: FilterPattern;
19
- include?: FilterPattern;
20
- classListPath?: string;
21
- classMapOutput?: boolean | ClassMapOutputOptions | ((json: ClassMapOutputItem[]) => void);
22
- disabled?: boolean;
23
- preserveFunction?: string[];
24
- }
25
- interface PatchUserConfig {
26
- output?: {
27
- filename?: string;
28
- loose?: boolean;
29
- /**
30
- * @description remove * in output json
31
- */
32
- removeUniversalSelector?: boolean;
33
- };
34
- tailwindcss?: {
35
- cwd?: string;
36
- config?: string;
37
- };
38
- }
39
- interface UserConfig {
40
- patch?: PatchUserConfig;
41
- mangle?: MangleUserConfig;
42
- }
43
-
44
- declare function getConfig(cwd?: string): Promise<c12.ResolvedConfig<UserConfig, c12.ConfigLayerMeta>>;
45
- declare const defineConfig: c12.DefineConfig<UserConfig, c12.ConfigLayerMeta>;
46
- declare function initConfig(cwd: string): Promise<void>;
47
-
48
- declare function getDefaultPatchConfig(): PatchUserConfig;
49
- declare function getDefaultMangleUserConfig(): MangleUserConfig;
50
- declare function getDefaultUserConfig(): UserConfig;
51
-
52
- declare const configName = "tailwindcss-mangle";
53
-
54
- export { type ClassMapOutputItem, type ClassMapOutputOptions, type MangleUserConfig, type PatchUserConfig, type UserConfig, configName, defineConfig, getConfig, getDefaultMangleUserConfig, getDefaultPatchConfig, getDefaultUserConfig, initConfig };
package/dist/index.d.ts DELETED
@@ -1,54 +0,0 @@
1
- import * as c12 from 'c12';
2
- import { IClassGeneratorOptions } from '@tailwindcss-mangle/shared';
3
- import { FilterPattern } from '@rollup/pluginutils';
4
-
5
- interface ClassMapOutputOptions {
6
- enable?: boolean;
7
- filename?: string;
8
- loose?: boolean;
9
- }
10
- interface ClassMapOutputItem {
11
- before: string;
12
- after: string;
13
- usedBy: string[];
14
- }
15
- interface MangleUserConfig {
16
- mangleClassFilter?: (className: string) => boolean;
17
- classGenerator?: IClassGeneratorOptions;
18
- exclude?: FilterPattern;
19
- include?: FilterPattern;
20
- classListPath?: string;
21
- classMapOutput?: boolean | ClassMapOutputOptions | ((json: ClassMapOutputItem[]) => void);
22
- disabled?: boolean;
23
- preserveFunction?: string[];
24
- }
25
- interface PatchUserConfig {
26
- output?: {
27
- filename?: string;
28
- loose?: boolean;
29
- /**
30
- * @description remove * in output json
31
- */
32
- removeUniversalSelector?: boolean;
33
- };
34
- tailwindcss?: {
35
- cwd?: string;
36
- config?: string;
37
- };
38
- }
39
- interface UserConfig {
40
- patch?: PatchUserConfig;
41
- mangle?: MangleUserConfig;
42
- }
43
-
44
- declare function getConfig(cwd?: string): Promise<c12.ResolvedConfig<UserConfig, c12.ConfigLayerMeta>>;
45
- declare const defineConfig: c12.DefineConfig<UserConfig, c12.ConfigLayerMeta>;
46
- declare function initConfig(cwd: string): Promise<void>;
47
-
48
- declare function getDefaultPatchConfig(): PatchUserConfig;
49
- declare function getDefaultMangleUserConfig(): MangleUserConfig;
50
- declare function getDefaultUserConfig(): UserConfig;
51
-
52
- declare const configName = "tailwindcss-mangle";
53
-
54
- export { type ClassMapOutputItem, type ClassMapOutputOptions, type MangleUserConfig, type PatchUserConfig, type UserConfig, configName, defineConfig, getConfig, getDefaultMangleUserConfig, getDefaultPatchConfig, getDefaultUserConfig, initConfig };
package/dist/index.mjs DELETED
@@ -1,65 +0,0 @@
1
- import path from 'node:path';
2
- import fs from 'node:fs/promises';
3
- import { createDefineConfig, loadConfig } from 'c12';
4
- import process from 'node:process';
5
- import { defaultMangleClassFilter } from '@tailwindcss-mangle/shared';
6
- import { CSS_LANGS_RE } from 'is-css-request';
7
-
8
- const defaultPipelineInclude = ["**/*.{html,js,ts,jsx,tsx,vue,svelte,astro,elm,php,phtml,mdx,md}", CSS_LANGS_RE];
9
- const defaultPipelineExclude = [/[\\/](node_modules|dist|\.temp|\.cache|\.vscode)[\\/]/];
10
- function getDefaultPatchConfig() {
11
- return {
12
- output: {
13
- filename: ".tw-patch/tw-class-list.json",
14
- removeUniversalSelector: true,
15
- loose: true
16
- },
17
- tailwindcss: {}
18
- };
19
- }
20
- function getDefaultMangleUserConfig() {
21
- return {
22
- mangleClassFilter: defaultMangleClassFilter,
23
- include: defaultPipelineInclude,
24
- exclude: defaultPipelineExclude,
25
- disabled: process.env.NODE_ENV === "development",
26
- classListPath: ".tw-patch/tw-class-list.json",
27
- classMapOutput: {
28
- enable: false,
29
- filename: ".tw-patch/tw-map-list.json",
30
- loose: true
31
- },
32
- preserveFunction: []
33
- };
34
- }
35
- function getDefaultUserConfig() {
36
- return {
37
- patch: getDefaultPatchConfig(),
38
- mangle: getDefaultMangleUserConfig()
39
- };
40
- }
41
-
42
- const configName = "tailwindcss-mangle";
43
-
44
- function getConfig(cwd) {
45
- return loadConfig({
46
- name: configName,
47
- defaults: {
48
- ...getDefaultUserConfig()
49
- },
50
- cwd
51
- });
52
- }
53
- const defineConfig = createDefineConfig();
54
- function initConfig(cwd) {
55
- return fs.writeFile(
56
- path.resolve(cwd, `${configName}.config.ts`),
57
- `import { defineConfig } from 'tailwindcss-patch'
58
-
59
- export default defineConfig({})
60
- `,
61
- "utf8"
62
- );
63
- }
64
-
65
- export { configName, defineConfig, getConfig, getDefaultMangleUserConfig, getDefaultPatchConfig, getDefaultUserConfig, initConfig };