tailwindcss-patch 4.0.0 → 5.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/bin/tw-patch.js CHANGED
@@ -1,8 +1,2 @@
1
1
  #!/usr/bin/env node
2
- const fs = require('node:fs')
3
- const path = require('node:path')
4
-
5
- const cliPath = path.resolve(__dirname, '../dist/cli.cjs')
6
- if (fs.existsSync(cliPath)) {
7
- require(cliPath)
8
- }
2
+ import '../dist/cli.js'
package/package.json CHANGED
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "name": "tailwindcss-patch",
3
- "version": "4.0.0",
3
+ "type": "module",
4
+ "version": "5.0.0-alpha.0",
4
5
  "description": "patch tailwindcss for exposing context and extract classes",
5
6
  "author": "SonOfMagic <qq1324318532@gmail.com>",
6
7
  "license": "MIT",
@@ -18,8 +19,15 @@
18
19
  "extract",
19
20
  "class"
20
21
  ],
22
+ "exports": {
23
+ ".": {
24
+ "types": "./dist/index.d.ts",
25
+ "import": "./dist/index.js",
26
+ "require": "./dist/index.cjs"
27
+ }
28
+ },
21
29
  "main": "./dist/index.cjs",
22
- "module": "./dist/index.mjs",
30
+ "module": "./dist/index.js",
23
31
  "types": "./dist/index.d.ts",
24
32
  "bin": {
25
33
  "tw-patch": "bin/tw-patch.js",
@@ -34,7 +42,7 @@
34
42
  "registry": "https://registry.npmjs.org/"
35
43
  },
36
44
  "peerDependencies": {
37
- "tailwindcss": ">=3.0.0"
45
+ "tailwindcss": ">=2.0.0"
38
46
  },
39
47
  "peerDependenciesMeta": {
40
48
  "tailwindcss": {
@@ -42,25 +50,26 @@
42
50
  }
43
51
  },
44
52
  "dependencies": {
45
- "@babel/generator": "^7.24.10",
46
- "@babel/parser": "^7.24.8",
47
- "@babel/traverse": "^7.24.8",
48
- "@babel/types": "^7.24.9",
53
+ "@babel/generator": "^7.26.0",
54
+ "@babel/parser": "^7.26.1",
55
+ "@babel/traverse": "^7.25.9",
56
+ "@babel/types": "^7.26.0",
49
57
  "cac": "^6.7.14",
50
58
  "consola": "^3.2.3",
51
59
  "fs-extra": "^11.2.0",
52
- "jiti": "^1.21.6",
53
60
  "lilconfig": "^3.1.2",
54
- "postcss": "^8.4.39",
61
+ "pathe": "^1.1.2",
62
+ "postcss": "^8.4.47",
55
63
  "resolve": "^1.22.8",
56
64
  "semver": "^7.6.3",
57
- "@tailwindcss-mangle/config": "^3.0.0"
65
+ "tsx": "^4.19.2",
66
+ "@tailwindcss-mangle/config": "^4.0.0-alpha.0"
58
67
  },
59
68
  "scripts": {
60
- "dev": "unbuild --sourcemap",
61
- "build": "unbuild",
62
- "test": "vitest run --coverage.enabled",
69
+ "dev": "tsup --watch --sourcemap",
70
+ "build": "tsup",
71
+ "test": "pnpm run patch && vitest run --coverage.enabled",
63
72
  "test:dev": "vitest",
64
- "patch": "node bin/tw-patch.js install"
73
+ "patch": "tsx dev/bin.js install"
65
74
  }
66
75
  }
package/dist/cli.cjs DELETED
@@ -1,49 +0,0 @@
1
- 'use strict';
2
-
3
- const process = require('node:process');
4
- const cac = require('cac');
5
- const config = require('@tailwindcss-mangle/config');
6
- const index = require('./shared/tailwindcss-patch.3f156bec.cjs');
7
- require('node:path');
8
- require('fs-extra');
9
- require('@babel/types');
10
- require('resolve');
11
- require('semver');
12
- require('consola');
13
- require('@babel/generator');
14
- require('@babel/traverse');
15
- require('@babel/parser');
16
- require('postcss');
17
- require('lilconfig');
18
- require('jiti');
19
-
20
- function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e.default : e; }
21
-
22
- const process__default = /*#__PURE__*/_interopDefaultCompat(process);
23
- const cac__default = /*#__PURE__*/_interopDefaultCompat(cac);
24
-
25
- function init() {
26
- const cwd = process__default.cwd();
27
- return config.initConfig(cwd);
28
- }
29
- const cli = cac__default();
30
- cli.command("install", "patch install").action(() => {
31
- const twPatcher = new index.TailwindcssPatcher({
32
- patch: index.getPatchOptions()
33
- });
34
- twPatcher.patch();
35
- });
36
- cli.command("init").action(async () => {
37
- await init();
38
- index.logger.success(`\u2728 ${config.configName}.config.ts initialized!`);
39
- });
40
- cli.command("extract").action(async () => {
41
- const { config: config$1 } = await config.getConfig();
42
- if (config$1) {
43
- const twPatcher = new index.TailwindcssPatcher();
44
- const p = await twPatcher.extract(config$1.patch);
45
- index.logger.success(`\u2728 tailwindcss-patch extract success! file path: ${p}`);
46
- }
47
- });
48
- cli.help();
49
- cli.parse();
package/dist/cli.d.cts DELETED
@@ -1,2 +0,0 @@
1
-
2
- export { }
package/dist/cli.d.mts DELETED
@@ -1,2 +0,0 @@
1
-
2
- export { }
package/dist/cli.d.ts DELETED
@@ -1,2 +0,0 @@
1
-
2
- export { }
package/dist/cli.mjs DELETED
@@ -1,42 +0,0 @@
1
- import process from 'node:process';
2
- import cac from 'cac';
3
- import { configName, getConfig, initConfig } from '@tailwindcss-mangle/config';
4
- import { T as TailwindcssPatcher, g as getPatchOptions, l as logger } from './shared/tailwindcss-patch.324d67e5.mjs';
5
- import 'node:path';
6
- import 'fs-extra';
7
- import '@babel/types';
8
- import 'resolve';
9
- import 'semver';
10
- import 'consola';
11
- import '@babel/generator';
12
- import '@babel/traverse';
13
- import '@babel/parser';
14
- import 'postcss';
15
- import 'lilconfig';
16
- import 'jiti';
17
-
18
- function init() {
19
- const cwd = process.cwd();
20
- return initConfig(cwd);
21
- }
22
- const cli = cac();
23
- cli.command("install", "patch install").action(() => {
24
- const twPatcher = new TailwindcssPatcher({
25
- patch: getPatchOptions()
26
- });
27
- twPatcher.patch();
28
- });
29
- cli.command("init").action(async () => {
30
- await init();
31
- logger.success(`\u2728 ${configName}.config.ts initialized!`);
32
- });
33
- cli.command("extract").action(async () => {
34
- const { config } = await getConfig();
35
- if (config) {
36
- const twPatcher = new TailwindcssPatcher();
37
- const p = await twPatcher.extract(config.patch);
38
- logger.success(`\u2728 tailwindcss-patch extract success! file path: ${p}`);
39
- }
40
- });
41
- cli.help();
42
- cli.parse();
package/dist/index.cjs DELETED
@@ -1,29 +0,0 @@
1
- 'use strict';
2
-
3
- const index = require('./shared/tailwindcss-patch.3f156bec.cjs');
4
- const config = require('@tailwindcss-mangle/config');
5
- require('node:path');
6
- require('fs-extra');
7
- require('node:process');
8
- require('consola');
9
- require('semver');
10
- require('@babel/types');
11
- require('@babel/generator');
12
- require('@babel/traverse');
13
- require('@babel/parser');
14
- require('resolve');
15
- require('postcss');
16
- require('lilconfig');
17
- require('jiti');
18
-
19
-
20
-
21
- exports.CacheManager = index.CacheManager;
22
- exports.TailwindcssPatcher = index.TailwindcssPatcher;
23
- exports.getCacheOptions = index.getCacheOptions;
24
- exports.internalPatch = index.internalPatch;
25
- exports.logger = index.logger;
26
- exports.monkeyPatchForExposingContextV2 = index.monkeyPatchForExposingContextV2;
27
- exports.monkeyPatchForExposingContextV3 = index.monkeyPatchForExposingContextV3;
28
- exports.monkeyPatchForSupportingCustomUnit = index.monkeyPatchForSupportingCustomUnit;
29
- exports.defineConfig = config.defineConfig;
package/dist/index.d.cts DELETED
@@ -1,143 +0,0 @@
1
- import { Rule, Node } from 'postcss';
2
- import { Config } from 'tailwindcss';
3
- import { UserConfig } from '@tailwindcss-mangle/config';
4
- export { defineConfig } from '@tailwindcss-mangle/config';
5
- import * as consola from 'consola';
6
-
7
- type CacheStrategy = 'merge' | 'overwrite';
8
- interface PackageInfo {
9
- name: string;
10
- version: string | undefined;
11
- rootPath: string;
12
- packageJsonPath: string;
13
- }
14
- interface CacheOptions {
15
- dir?: string;
16
- cwd?: string;
17
- file?: string;
18
- strategy?: CacheStrategy;
19
- }
20
- interface InternalCacheOptions extends CacheOptions {
21
- enable?: boolean;
22
- }
23
- interface PatchOptions {
24
- overwrite?: boolean;
25
- paths?: string[];
26
- basedir?: string;
27
- applyPatches?: {
28
- exportContext?: boolean;
29
- extendLengthUnits?: boolean | ILengthUnitsPatchOptions;
30
- };
31
- }
32
- interface InternalPatchOptions extends PatchOptions {
33
- version?: string;
34
- }
35
- interface TailwindcssPatcherOptions {
36
- cache?: CacheOptions | boolean;
37
- patch?: PatchOptions;
38
- }
39
- type TailwindcssClassCache = Map<string, ({
40
- layer: string;
41
- options: Record<string, any>;
42
- sort: Record<string, any>;
43
- } | Rule)[]>;
44
- interface TailwindcssRuntimeContext {
45
- applyClassCache: Map<any, any>;
46
- candidateRuleCache: Map<string | string, Set<[
47
- {
48
- arbitrary: any;
49
- index: any;
50
- layer: string;
51
- options: any[];
52
- parallelIndex: any;
53
- parentLayer: string;
54
- variants: any;
55
- },
56
- Node
57
- ]>>;
58
- candidateRuleMap: Map<string | string, [object, Node][]>;
59
- changedContent: any[];
60
- classCache: TailwindcssClassCache;
61
- disposables: any[];
62
- getClassList: Function;
63
- getClassOrder: Function;
64
- getVariants: Function;
65
- markInvalidUtilityCandidate: Function;
66
- markInvalidUtilityNode: Function;
67
- notClassCache: Set<string>;
68
- offsets: {
69
- layerPositions: object;
70
- offsets: object;
71
- reservedVariantBits: any;
72
- variantOffsets: Map<string, any>;
73
- };
74
- postCssNodeCache: Map<object, [Node]>;
75
- ruleCache: Set<[object, Node]>;
76
- stylesheetCache: Record<string, Set<any>>;
77
- tailwindConfig: Config;
78
- userConfigPath: string | null;
79
- variantMap: Map<string, [[object, Function]]>;
80
- variantOptions: Map<string, object>;
81
- }
82
- type DeepRequired<T> = {
83
- [K in keyof T]: Required<DeepRequired<T[K]>>;
84
- };
85
- interface ILengthUnitsPatchOptions {
86
- units: string[];
87
- lengthUnitsFilePath?: string;
88
- variableName?: string;
89
- overwrite?: boolean;
90
- destPath?: string;
91
- }
92
-
93
- declare function getCacheOptions(options?: CacheOptions | boolean): InternalCacheOptions;
94
- declare class CacheManager {
95
- options: Required<CacheOptions> & {
96
- filename: string;
97
- };
98
- constructor(options?: CacheOptions);
99
- getOptions(options?: CacheOptions): Required<CacheOptions> & {
100
- filename: string;
101
- };
102
- write(data: Set<string>): string | undefined;
103
- read(): Set<string> | undefined;
104
- }
105
-
106
- declare class TailwindcssPatcher {
107
- rawOptions: TailwindcssPatcherOptions;
108
- cacheOptions: InternalCacheOptions;
109
- patchOptions: InternalPatchOptions;
110
- patch: () => void;
111
- cacheManager: CacheManager;
112
- packageInfo?: PackageInfo;
113
- majorVersion?: number;
114
- constructor(options?: TailwindcssPatcherOptions);
115
- setCache(set: Set<string>): string | undefined;
116
- getCache(): Set<string> | undefined;
117
- getContexts(): TailwindcssRuntimeContext[];
118
- getClassCaches(): TailwindcssClassCache[];
119
- getClassCacheSet(options?: {
120
- removeUniversalSelector?: boolean;
121
- }): Set<string>;
122
- /**
123
- * @description 在多个 tailwindcss 上下文时,这个方法将被执行多次,所以策略上应该使用 append
124
- */
125
- getClassSet(options?: {
126
- cacheStrategy?: CacheStrategy;
127
- removeUniversalSelector?: boolean;
128
- }): Set<string>;
129
- extract(options?: UserConfig['patch']): Promise<string | undefined>;
130
- }
131
-
132
- declare function monkeyPatchForExposingContextV3(twDir: string, opt: InternalPatchOptions): Record<string, any> | undefined;
133
- declare function monkeyPatchForExposingContextV2(twDir: string, opt: InternalPatchOptions): Record<string, any>;
134
-
135
- declare function monkeyPatchForSupportingCustomUnit(rootDir: string, options?: Partial<ILengthUnitsPatchOptions>): {
136
- [x: string]: string;
137
- } | undefined;
138
-
139
- declare function internalPatch(pkgJsonPath: string | undefined, options: InternalPatchOptions): Record<string, any> | undefined;
140
-
141
- declare const logger: consola.ConsolaInstance;
142
-
143
- export { CacheManager, type CacheOptions, type CacheStrategy, type DeepRequired, type ILengthUnitsPatchOptions, type InternalCacheOptions, type InternalPatchOptions, type PackageInfo, type PatchOptions, type TailwindcssClassCache, TailwindcssPatcher, type TailwindcssPatcherOptions, type TailwindcssRuntimeContext, getCacheOptions, internalPatch, logger, monkeyPatchForExposingContextV2, monkeyPatchForExposingContextV3, monkeyPatchForSupportingCustomUnit };
package/dist/index.d.mts DELETED
@@ -1,143 +0,0 @@
1
- import { Rule, Node } from 'postcss';
2
- import { Config } from 'tailwindcss';
3
- import { UserConfig } from '@tailwindcss-mangle/config';
4
- export { defineConfig } from '@tailwindcss-mangle/config';
5
- import * as consola from 'consola';
6
-
7
- type CacheStrategy = 'merge' | 'overwrite';
8
- interface PackageInfo {
9
- name: string;
10
- version: string | undefined;
11
- rootPath: string;
12
- packageJsonPath: string;
13
- }
14
- interface CacheOptions {
15
- dir?: string;
16
- cwd?: string;
17
- file?: string;
18
- strategy?: CacheStrategy;
19
- }
20
- interface InternalCacheOptions extends CacheOptions {
21
- enable?: boolean;
22
- }
23
- interface PatchOptions {
24
- overwrite?: boolean;
25
- paths?: string[];
26
- basedir?: string;
27
- applyPatches?: {
28
- exportContext?: boolean;
29
- extendLengthUnits?: boolean | ILengthUnitsPatchOptions;
30
- };
31
- }
32
- interface InternalPatchOptions extends PatchOptions {
33
- version?: string;
34
- }
35
- interface TailwindcssPatcherOptions {
36
- cache?: CacheOptions | boolean;
37
- patch?: PatchOptions;
38
- }
39
- type TailwindcssClassCache = Map<string, ({
40
- layer: string;
41
- options: Record<string, any>;
42
- sort: Record<string, any>;
43
- } | Rule)[]>;
44
- interface TailwindcssRuntimeContext {
45
- applyClassCache: Map<any, any>;
46
- candidateRuleCache: Map<string | string, Set<[
47
- {
48
- arbitrary: any;
49
- index: any;
50
- layer: string;
51
- options: any[];
52
- parallelIndex: any;
53
- parentLayer: string;
54
- variants: any;
55
- },
56
- Node
57
- ]>>;
58
- candidateRuleMap: Map<string | string, [object, Node][]>;
59
- changedContent: any[];
60
- classCache: TailwindcssClassCache;
61
- disposables: any[];
62
- getClassList: Function;
63
- getClassOrder: Function;
64
- getVariants: Function;
65
- markInvalidUtilityCandidate: Function;
66
- markInvalidUtilityNode: Function;
67
- notClassCache: Set<string>;
68
- offsets: {
69
- layerPositions: object;
70
- offsets: object;
71
- reservedVariantBits: any;
72
- variantOffsets: Map<string, any>;
73
- };
74
- postCssNodeCache: Map<object, [Node]>;
75
- ruleCache: Set<[object, Node]>;
76
- stylesheetCache: Record<string, Set<any>>;
77
- tailwindConfig: Config;
78
- userConfigPath: string | null;
79
- variantMap: Map<string, [[object, Function]]>;
80
- variantOptions: Map<string, object>;
81
- }
82
- type DeepRequired<T> = {
83
- [K in keyof T]: Required<DeepRequired<T[K]>>;
84
- };
85
- interface ILengthUnitsPatchOptions {
86
- units: string[];
87
- lengthUnitsFilePath?: string;
88
- variableName?: string;
89
- overwrite?: boolean;
90
- destPath?: string;
91
- }
92
-
93
- declare function getCacheOptions(options?: CacheOptions | boolean): InternalCacheOptions;
94
- declare class CacheManager {
95
- options: Required<CacheOptions> & {
96
- filename: string;
97
- };
98
- constructor(options?: CacheOptions);
99
- getOptions(options?: CacheOptions): Required<CacheOptions> & {
100
- filename: string;
101
- };
102
- write(data: Set<string>): string | undefined;
103
- read(): Set<string> | undefined;
104
- }
105
-
106
- declare class TailwindcssPatcher {
107
- rawOptions: TailwindcssPatcherOptions;
108
- cacheOptions: InternalCacheOptions;
109
- patchOptions: InternalPatchOptions;
110
- patch: () => void;
111
- cacheManager: CacheManager;
112
- packageInfo?: PackageInfo;
113
- majorVersion?: number;
114
- constructor(options?: TailwindcssPatcherOptions);
115
- setCache(set: Set<string>): string | undefined;
116
- getCache(): Set<string> | undefined;
117
- getContexts(): TailwindcssRuntimeContext[];
118
- getClassCaches(): TailwindcssClassCache[];
119
- getClassCacheSet(options?: {
120
- removeUniversalSelector?: boolean;
121
- }): Set<string>;
122
- /**
123
- * @description 在多个 tailwindcss 上下文时,这个方法将被执行多次,所以策略上应该使用 append
124
- */
125
- getClassSet(options?: {
126
- cacheStrategy?: CacheStrategy;
127
- removeUniversalSelector?: boolean;
128
- }): Set<string>;
129
- extract(options?: UserConfig['patch']): Promise<string | undefined>;
130
- }
131
-
132
- declare function monkeyPatchForExposingContextV3(twDir: string, opt: InternalPatchOptions): Record<string, any> | undefined;
133
- declare function monkeyPatchForExposingContextV2(twDir: string, opt: InternalPatchOptions): Record<string, any>;
134
-
135
- declare function monkeyPatchForSupportingCustomUnit(rootDir: string, options?: Partial<ILengthUnitsPatchOptions>): {
136
- [x: string]: string;
137
- } | undefined;
138
-
139
- declare function internalPatch(pkgJsonPath: string | undefined, options: InternalPatchOptions): Record<string, any> | undefined;
140
-
141
- declare const logger: consola.ConsolaInstance;
142
-
143
- export { CacheManager, type CacheOptions, type CacheStrategy, type DeepRequired, type ILengthUnitsPatchOptions, type InternalCacheOptions, type InternalPatchOptions, type PackageInfo, type PatchOptions, type TailwindcssClassCache, TailwindcssPatcher, type TailwindcssPatcherOptions, type TailwindcssRuntimeContext, getCacheOptions, internalPatch, logger, monkeyPatchForExposingContextV2, monkeyPatchForExposingContextV3, monkeyPatchForSupportingCustomUnit };
package/dist/index.d.ts DELETED
@@ -1,143 +0,0 @@
1
- import { Rule, Node } from 'postcss';
2
- import { Config } from 'tailwindcss';
3
- import { UserConfig } from '@tailwindcss-mangle/config';
4
- export { defineConfig } from '@tailwindcss-mangle/config';
5
- import * as consola from 'consola';
6
-
7
- type CacheStrategy = 'merge' | 'overwrite';
8
- interface PackageInfo {
9
- name: string;
10
- version: string | undefined;
11
- rootPath: string;
12
- packageJsonPath: string;
13
- }
14
- interface CacheOptions {
15
- dir?: string;
16
- cwd?: string;
17
- file?: string;
18
- strategy?: CacheStrategy;
19
- }
20
- interface InternalCacheOptions extends CacheOptions {
21
- enable?: boolean;
22
- }
23
- interface PatchOptions {
24
- overwrite?: boolean;
25
- paths?: string[];
26
- basedir?: string;
27
- applyPatches?: {
28
- exportContext?: boolean;
29
- extendLengthUnits?: boolean | ILengthUnitsPatchOptions;
30
- };
31
- }
32
- interface InternalPatchOptions extends PatchOptions {
33
- version?: string;
34
- }
35
- interface TailwindcssPatcherOptions {
36
- cache?: CacheOptions | boolean;
37
- patch?: PatchOptions;
38
- }
39
- type TailwindcssClassCache = Map<string, ({
40
- layer: string;
41
- options: Record<string, any>;
42
- sort: Record<string, any>;
43
- } | Rule)[]>;
44
- interface TailwindcssRuntimeContext {
45
- applyClassCache: Map<any, any>;
46
- candidateRuleCache: Map<string | string, Set<[
47
- {
48
- arbitrary: any;
49
- index: any;
50
- layer: string;
51
- options: any[];
52
- parallelIndex: any;
53
- parentLayer: string;
54
- variants: any;
55
- },
56
- Node
57
- ]>>;
58
- candidateRuleMap: Map<string | string, [object, Node][]>;
59
- changedContent: any[];
60
- classCache: TailwindcssClassCache;
61
- disposables: any[];
62
- getClassList: Function;
63
- getClassOrder: Function;
64
- getVariants: Function;
65
- markInvalidUtilityCandidate: Function;
66
- markInvalidUtilityNode: Function;
67
- notClassCache: Set<string>;
68
- offsets: {
69
- layerPositions: object;
70
- offsets: object;
71
- reservedVariantBits: any;
72
- variantOffsets: Map<string, any>;
73
- };
74
- postCssNodeCache: Map<object, [Node]>;
75
- ruleCache: Set<[object, Node]>;
76
- stylesheetCache: Record<string, Set<any>>;
77
- tailwindConfig: Config;
78
- userConfigPath: string | null;
79
- variantMap: Map<string, [[object, Function]]>;
80
- variantOptions: Map<string, object>;
81
- }
82
- type DeepRequired<T> = {
83
- [K in keyof T]: Required<DeepRequired<T[K]>>;
84
- };
85
- interface ILengthUnitsPatchOptions {
86
- units: string[];
87
- lengthUnitsFilePath?: string;
88
- variableName?: string;
89
- overwrite?: boolean;
90
- destPath?: string;
91
- }
92
-
93
- declare function getCacheOptions(options?: CacheOptions | boolean): InternalCacheOptions;
94
- declare class CacheManager {
95
- options: Required<CacheOptions> & {
96
- filename: string;
97
- };
98
- constructor(options?: CacheOptions);
99
- getOptions(options?: CacheOptions): Required<CacheOptions> & {
100
- filename: string;
101
- };
102
- write(data: Set<string>): string | undefined;
103
- read(): Set<string> | undefined;
104
- }
105
-
106
- declare class TailwindcssPatcher {
107
- rawOptions: TailwindcssPatcherOptions;
108
- cacheOptions: InternalCacheOptions;
109
- patchOptions: InternalPatchOptions;
110
- patch: () => void;
111
- cacheManager: CacheManager;
112
- packageInfo?: PackageInfo;
113
- majorVersion?: number;
114
- constructor(options?: TailwindcssPatcherOptions);
115
- setCache(set: Set<string>): string | undefined;
116
- getCache(): Set<string> | undefined;
117
- getContexts(): TailwindcssRuntimeContext[];
118
- getClassCaches(): TailwindcssClassCache[];
119
- getClassCacheSet(options?: {
120
- removeUniversalSelector?: boolean;
121
- }): Set<string>;
122
- /**
123
- * @description 在多个 tailwindcss 上下文时,这个方法将被执行多次,所以策略上应该使用 append
124
- */
125
- getClassSet(options?: {
126
- cacheStrategy?: CacheStrategy;
127
- removeUniversalSelector?: boolean;
128
- }): Set<string>;
129
- extract(options?: UserConfig['patch']): Promise<string | undefined>;
130
- }
131
-
132
- declare function monkeyPatchForExposingContextV3(twDir: string, opt: InternalPatchOptions): Record<string, any> | undefined;
133
- declare function monkeyPatchForExposingContextV2(twDir: string, opt: InternalPatchOptions): Record<string, any>;
134
-
135
- declare function monkeyPatchForSupportingCustomUnit(rootDir: string, options?: Partial<ILengthUnitsPatchOptions>): {
136
- [x: string]: string;
137
- } | undefined;
138
-
139
- declare function internalPatch(pkgJsonPath: string | undefined, options: InternalPatchOptions): Record<string, any> | undefined;
140
-
141
- declare const logger: consola.ConsolaInstance;
142
-
143
- export { CacheManager, type CacheOptions, type CacheStrategy, type DeepRequired, type ILengthUnitsPatchOptions, type InternalCacheOptions, type InternalPatchOptions, type PackageInfo, type PatchOptions, type TailwindcssClassCache, TailwindcssPatcher, type TailwindcssPatcherOptions, type TailwindcssRuntimeContext, getCacheOptions, internalPatch, logger, monkeyPatchForExposingContextV2, monkeyPatchForExposingContextV3, monkeyPatchForSupportingCustomUnit };
package/dist/index.mjs DELETED
@@ -1,15 +0,0 @@
1
- export { C as CacheManager, T as TailwindcssPatcher, c as getCacheOptions, i as internalPatch, l as logger, a as monkeyPatchForExposingContextV2, m as monkeyPatchForExposingContextV3, b as monkeyPatchForSupportingCustomUnit } from './shared/tailwindcss-patch.324d67e5.mjs';
2
- export { defineConfig } from '@tailwindcss-mangle/config';
3
- import 'node:path';
4
- import 'fs-extra';
5
- import 'node:process';
6
- import 'consola';
7
- import 'semver';
8
- import '@babel/types';
9
- import '@babel/generator';
10
- import '@babel/traverse';
11
- import '@babel/parser';
12
- import 'resolve';
13
- import 'postcss';
14
- import 'lilconfig';
15
- import 'jiti';