@tailwindcss-mangle/config 4.0.0 → 4.0.1
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/index.cjs +122 -0
- package/dist/index.d.cts +54 -0
- package/dist/index.d.ts +54 -0
- package/dist/index.js +79 -0
- package/package.json +2 -2
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
|
|
30
|
+
// src/index.ts
|
|
31
|
+
var src_exports = {};
|
|
32
|
+
__export(src_exports, {
|
|
33
|
+
configName: () => configName,
|
|
34
|
+
defineConfig: () => defineConfig,
|
|
35
|
+
getConfig: () => getConfig,
|
|
36
|
+
getDefaultMangleUserConfig: () => getDefaultMangleUserConfig,
|
|
37
|
+
getDefaultPatchConfig: () => getDefaultPatchConfig,
|
|
38
|
+
getDefaultUserConfig: () => getDefaultUserConfig,
|
|
39
|
+
initConfig: () => initConfig
|
|
40
|
+
});
|
|
41
|
+
module.exports = __toCommonJS(src_exports);
|
|
42
|
+
|
|
43
|
+
// src/config.ts
|
|
44
|
+
var import_c12 = require("c12");
|
|
45
|
+
var import_fs_extra = __toESM(require("fs-extra"), 1);
|
|
46
|
+
var import_pathe = __toESM(require("pathe"), 1);
|
|
47
|
+
|
|
48
|
+
// src/constants.ts
|
|
49
|
+
var configName = "tailwindcss-mangle";
|
|
50
|
+
|
|
51
|
+
// src/defaults.ts
|
|
52
|
+
var import_node_process = __toESM(require("process"), 1);
|
|
53
|
+
var import_shared = require("@tailwindcss-mangle/shared");
|
|
54
|
+
var import_is_css_request = require("is-css-request");
|
|
55
|
+
var defaultPipelineInclude = [
|
|
56
|
+
/\.(html|js|ts|jsx|tsx|vue|svelte|astro|elm|php|phtml|mdx|md)(?:$|\?)/,
|
|
57
|
+
import_is_css_request.CSS_LANGS_RE
|
|
58
|
+
];
|
|
59
|
+
var defaultPipelineExclude = [];
|
|
60
|
+
function getDefaultPatchConfig() {
|
|
61
|
+
return {
|
|
62
|
+
output: {
|
|
63
|
+
filename: ".tw-patch/tw-class-list.json",
|
|
64
|
+
removeUniversalSelector: true,
|
|
65
|
+
loose: true
|
|
66
|
+
},
|
|
67
|
+
tailwindcss: {}
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
function getDefaultMangleUserConfig() {
|
|
71
|
+
return {
|
|
72
|
+
mangleClassFilter: import_shared.defaultMangleClassFilter,
|
|
73
|
+
include: defaultPipelineInclude,
|
|
74
|
+
exclude: defaultPipelineExclude,
|
|
75
|
+
disabled: import_node_process.default.env.NODE_ENV === "development",
|
|
76
|
+
classListPath: ".tw-patch/tw-class-list.json",
|
|
77
|
+
classMapOutput: {
|
|
78
|
+
enable: false,
|
|
79
|
+
filename: ".tw-patch/tw-map-list.json",
|
|
80
|
+
loose: true
|
|
81
|
+
},
|
|
82
|
+
preserveFunction: []
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
function getDefaultUserConfig() {
|
|
86
|
+
return {
|
|
87
|
+
patch: getDefaultPatchConfig(),
|
|
88
|
+
mangle: getDefaultMangleUserConfig()
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
// src/config.ts
|
|
93
|
+
function getConfig(cwd) {
|
|
94
|
+
return (0, import_c12.loadConfig)({
|
|
95
|
+
name: configName,
|
|
96
|
+
defaults: {
|
|
97
|
+
...getDefaultUserConfig()
|
|
98
|
+
},
|
|
99
|
+
cwd
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
var defineConfig = (0, import_c12.createDefineConfig)();
|
|
103
|
+
function initConfig(cwd) {
|
|
104
|
+
return import_fs_extra.default.outputFile(
|
|
105
|
+
import_pathe.default.resolve(cwd, `${configName}.config.ts`),
|
|
106
|
+
`import { defineConfig } from 'tailwindcss-patch'
|
|
107
|
+
|
|
108
|
+
export default defineConfig({})
|
|
109
|
+
`,
|
|
110
|
+
"utf8"
|
|
111
|
+
);
|
|
112
|
+
}
|
|
113
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
114
|
+
0 && (module.exports = {
|
|
115
|
+
configName,
|
|
116
|
+
defineConfig,
|
|
117
|
+
getConfig,
|
|
118
|
+
getDefaultMangleUserConfig,
|
|
119
|
+
getDefaultPatchConfig,
|
|
120
|
+
getDefaultUserConfig,
|
|
121
|
+
initConfig
|
|
122
|
+
});
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import * as c12 from 'c12';
|
|
2
|
+
import { FilterPattern } from '@rollup/pluginutils';
|
|
3
|
+
import { IClassGeneratorOptions } from '@tailwindcss-mangle/shared';
|
|
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 const configName = "tailwindcss-mangle";
|
|
49
|
+
|
|
50
|
+
declare function getDefaultPatchConfig(): PatchUserConfig;
|
|
51
|
+
declare function getDefaultMangleUserConfig(): MangleUserConfig;
|
|
52
|
+
declare function getDefaultUserConfig(): UserConfig;
|
|
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
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import * as c12 from 'c12';
|
|
2
|
+
import { FilterPattern } from '@rollup/pluginutils';
|
|
3
|
+
import { IClassGeneratorOptions } from '@tailwindcss-mangle/shared';
|
|
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 const configName = "tailwindcss-mangle";
|
|
49
|
+
|
|
50
|
+
declare function getDefaultPatchConfig(): PatchUserConfig;
|
|
51
|
+
declare function getDefaultMangleUserConfig(): MangleUserConfig;
|
|
52
|
+
declare function getDefaultUserConfig(): UserConfig;
|
|
53
|
+
|
|
54
|
+
export { type ClassMapOutputItem, type ClassMapOutputOptions, type MangleUserConfig, type PatchUserConfig, type UserConfig, configName, defineConfig, getConfig, getDefaultMangleUserConfig, getDefaultPatchConfig, getDefaultUserConfig, initConfig };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
// src/config.ts
|
|
2
|
+
import { createDefineConfig, loadConfig } from "c12";
|
|
3
|
+
import fs from "fs-extra";
|
|
4
|
+
import path from "pathe";
|
|
5
|
+
|
|
6
|
+
// src/constants.ts
|
|
7
|
+
var configName = "tailwindcss-mangle";
|
|
8
|
+
|
|
9
|
+
// src/defaults.ts
|
|
10
|
+
import process from "node:process";
|
|
11
|
+
import { defaultMangleClassFilter } from "@tailwindcss-mangle/shared";
|
|
12
|
+
import { CSS_LANGS_RE } from "is-css-request";
|
|
13
|
+
var defaultPipelineInclude = [
|
|
14
|
+
/\.(html|js|ts|jsx|tsx|vue|svelte|astro|elm|php|phtml|mdx|md)(?:$|\?)/,
|
|
15
|
+
CSS_LANGS_RE
|
|
16
|
+
];
|
|
17
|
+
var defaultPipelineExclude = [];
|
|
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: defaultMangleClassFilter,
|
|
31
|
+
include: defaultPipelineInclude,
|
|
32
|
+
exclude: defaultPipelineExclude,
|
|
33
|
+
disabled: process.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
|
+
// src/config.ts
|
|
51
|
+
function getConfig(cwd) {
|
|
52
|
+
return loadConfig({
|
|
53
|
+
name: configName,
|
|
54
|
+
defaults: {
|
|
55
|
+
...getDefaultUserConfig()
|
|
56
|
+
},
|
|
57
|
+
cwd
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
var defineConfig = createDefineConfig();
|
|
61
|
+
function initConfig(cwd) {
|
|
62
|
+
return fs.outputFile(
|
|
63
|
+
path.resolve(cwd, `${configName}.config.ts`),
|
|
64
|
+
`import { defineConfig } from 'tailwindcss-patch'
|
|
65
|
+
|
|
66
|
+
export default defineConfig({})
|
|
67
|
+
`,
|
|
68
|
+
"utf8"
|
|
69
|
+
);
|
|
70
|
+
}
|
|
71
|
+
export {
|
|
72
|
+
configName,
|
|
73
|
+
defineConfig,
|
|
74
|
+
getConfig,
|
|
75
|
+
getDefaultMangleUserConfig,
|
|
76
|
+
getDefaultPatchConfig,
|
|
77
|
+
getDefaultUserConfig,
|
|
78
|
+
initConfig
|
|
79
|
+
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tailwindcss-mangle/config",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "4.0.
|
|
4
|
+
"version": "4.0.1",
|
|
5
5
|
"description": "The config and load function of tailwindcss-mangle",
|
|
6
6
|
"author": "ice breaker <1324318532@qq.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"fs-extra": "^11.2.0",
|
|
54
54
|
"is-css-request": "^1.0.1",
|
|
55
55
|
"pathe": "^1.1.2",
|
|
56
|
-
"@tailwindcss-mangle/shared": "^4.0.
|
|
56
|
+
"@tailwindcss-mangle/shared": "^4.0.1"
|
|
57
57
|
},
|
|
58
58
|
"scripts": {
|
|
59
59
|
"dev": "tsup --watch --sourcemap",
|