tailwindcss-patch 2.2.4 → 3.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/cli.cjs +11 -8
- package/dist/cli.mjs +9 -7
- package/dist/index.cjs +30 -602
- package/dist/index.d.cts +30 -20
- package/dist/index.d.mts +30 -20
- package/dist/index.d.ts +30 -20
- package/dist/index.mjs +14 -571
- package/dist/shared/tailwindcss-patch.1e524aba.cjs +802 -0
- package/dist/shared/tailwindcss-patch.9adeca36.mjs +771 -0
- package/package.json +34 -32
package/dist/index.d.cts
CHANGED
|
@@ -3,8 +3,15 @@ import { Config } from 'tailwindcss';
|
|
|
3
3
|
import { UserConfig } from '@tailwindcss-mangle/config';
|
|
4
4
|
export { defineConfig } from '@tailwindcss-mangle/config';
|
|
5
5
|
import { SyncOpts } from 'resolve';
|
|
6
|
+
import { PackageJson } from 'pkg-types';
|
|
6
7
|
|
|
7
8
|
type CacheStrategy = 'merge' | 'overwrite';
|
|
9
|
+
interface PackageInfo {
|
|
10
|
+
name: string;
|
|
11
|
+
version: string | undefined;
|
|
12
|
+
rootPath: string;
|
|
13
|
+
packageJsonPath: string;
|
|
14
|
+
}
|
|
8
15
|
interface CacheOptions {
|
|
9
16
|
dir?: string;
|
|
10
17
|
cwd?: string;
|
|
@@ -36,7 +43,7 @@ type TailwindcssClassCache = Map<string, ({
|
|
|
36
43
|
options: Record<string, any>;
|
|
37
44
|
sort: Record<string, any>;
|
|
38
45
|
} | Rule)[]>;
|
|
39
|
-
|
|
46
|
+
interface TailwindcssRuntimeContext {
|
|
40
47
|
applyClassCache: Map<any, any>;
|
|
41
48
|
candidateRuleCache: Map<string | string, Set<[
|
|
42
49
|
{
|
|
@@ -73,7 +80,7 @@ type TailwindcssRuntimeContext = {
|
|
|
73
80
|
userConfigPath: string | null;
|
|
74
81
|
variantMap: Map<string, [[object, Function]]>;
|
|
75
82
|
variantOptions: Map<string, object>;
|
|
76
|
-
}
|
|
83
|
+
}
|
|
77
84
|
type DeepRequired<T> = {
|
|
78
85
|
[K in keyof T]: Required<DeepRequired<T[K]>>;
|
|
79
86
|
};
|
|
@@ -98,32 +105,26 @@ declare class TailwindcssPatcher {
|
|
|
98
105
|
patchOptions: InternalPatchOptions;
|
|
99
106
|
patch: () => void;
|
|
100
107
|
cacheManager: CacheManager;
|
|
108
|
+
packageInfo?: PackageInfo;
|
|
109
|
+
majorVersion?: number;
|
|
101
110
|
constructor(options?: TailwindcssPatcherOptions);
|
|
102
|
-
getPkgEntry(basedir?: string): string;
|
|
103
111
|
setCache(set: Set<string>): string | undefined;
|
|
104
112
|
getCache(): Set<string> | undefined;
|
|
113
|
+
getContexts(): TailwindcssRuntimeContext[];
|
|
114
|
+
getClassCaches(): TailwindcssClassCache[];
|
|
115
|
+
getClassCacheSet(options?: {
|
|
116
|
+
removeUniversalSelector?: boolean;
|
|
117
|
+
}): Set<string>;
|
|
105
118
|
/**
|
|
106
119
|
* @description 在多个 tailwindcss 上下文时,这个方法将被执行多次,所以策略上应该使用 append
|
|
107
|
-
* 详见 taro weapp-tailwindcss 独立分包
|
|
108
|
-
* @param basedir
|
|
109
|
-
* @returns
|
|
110
120
|
*/
|
|
111
121
|
getClassSet(options?: {
|
|
112
|
-
basedir?: string;
|
|
113
122
|
cacheStrategy?: CacheStrategy;
|
|
114
123
|
removeUniversalSelector?: boolean;
|
|
115
124
|
}): Set<string>;
|
|
116
|
-
getContexts(basedir?: string): TailwindcssRuntimeContext[];
|
|
117
125
|
extract(options?: UserConfig['patch']): Promise<string | undefined>;
|
|
118
126
|
}
|
|
119
127
|
|
|
120
|
-
declare function getTailwindcssEntry(basedir?: string): string;
|
|
121
|
-
declare function getContexts(basedir?: string): TailwindcssRuntimeContext[];
|
|
122
|
-
declare function getClassCaches(basedir?: string): TailwindcssClassCache[];
|
|
123
|
-
declare function getClassCacheSet(basedir?: string, options?: {
|
|
124
|
-
removeUniversalSelector?: boolean;
|
|
125
|
-
}): Set<string>;
|
|
126
|
-
|
|
127
128
|
declare function inspectProcessTailwindFeaturesReturnContext(content: string): {
|
|
128
129
|
code: string;
|
|
129
130
|
hasPatched: boolean;
|
|
@@ -133,10 +134,11 @@ declare function inspectPostcssPlugin(content: string): {
|
|
|
133
134
|
hasPatched: boolean;
|
|
134
135
|
};
|
|
135
136
|
|
|
136
|
-
declare function
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
137
|
+
declare function monkeyPatchForExposingContextV3(twDir: string, opt: InternalPatchOptions): {
|
|
138
|
+
processTailwindFeatures?: string | undefined;
|
|
139
|
+
plugin?: string | undefined;
|
|
140
|
+
} & Record<string, any>;
|
|
141
|
+
declare function monkeyPatchForExposingContextV2(twDir: string, opt: InternalPatchOptions): {
|
|
140
142
|
processTailwindFeatures?: string | undefined;
|
|
141
143
|
plugin?: string | undefined;
|
|
142
144
|
} & Record<string, any>;
|
|
@@ -145,5 +147,13 @@ declare function internalPatch(pkgJsonPath: string | undefined, options: Interna
|
|
|
145
147
|
declare function ensureFileContent(filepaths: string | string[]): string | undefined;
|
|
146
148
|
declare function requireResolve(id: string, opts?: SyncOpts): string;
|
|
147
149
|
declare function ensureDir(p: string): Promise<void>;
|
|
150
|
+
declare function getPackageInfoSync(name: string, options?: SyncOpts): {
|
|
151
|
+
name: string;
|
|
152
|
+
version: string | undefined;
|
|
153
|
+
rootPath: string;
|
|
154
|
+
packageJsonPath: string;
|
|
155
|
+
packageJson: PackageJson;
|
|
156
|
+
} | undefined;
|
|
157
|
+
declare function isObject(val: any): boolean;
|
|
148
158
|
|
|
149
|
-
export { CacheManager, type CacheOptions, type CacheStrategy, type DeepRequired, type InternalCacheOptions, type InternalPatchOptions, type PatchOptions, type TailwindcssClassCache, TailwindcssPatcher, type TailwindcssPatcherOptions, type TailwindcssRuntimeContext,
|
|
159
|
+
export { CacheManager, type CacheOptions, type CacheStrategy, type DeepRequired, type InternalCacheOptions, type InternalPatchOptions, type PackageInfo, type PatchOptions, type TailwindcssClassCache, TailwindcssPatcher, type TailwindcssPatcherOptions, type TailwindcssRuntimeContext, ensureDir, ensureFileContent, getCacheOptions, getPackageInfoSync, inspectPostcssPlugin, inspectProcessTailwindFeaturesReturnContext, internalPatch, isObject, monkeyPatchForExposingContextV2, monkeyPatchForExposingContextV3, requireResolve };
|
package/dist/index.d.mts
CHANGED
|
@@ -3,8 +3,15 @@ import { Config } from 'tailwindcss';
|
|
|
3
3
|
import { UserConfig } from '@tailwindcss-mangle/config';
|
|
4
4
|
export { defineConfig } from '@tailwindcss-mangle/config';
|
|
5
5
|
import { SyncOpts } from 'resolve';
|
|
6
|
+
import { PackageJson } from 'pkg-types';
|
|
6
7
|
|
|
7
8
|
type CacheStrategy = 'merge' | 'overwrite';
|
|
9
|
+
interface PackageInfo {
|
|
10
|
+
name: string;
|
|
11
|
+
version: string | undefined;
|
|
12
|
+
rootPath: string;
|
|
13
|
+
packageJsonPath: string;
|
|
14
|
+
}
|
|
8
15
|
interface CacheOptions {
|
|
9
16
|
dir?: string;
|
|
10
17
|
cwd?: string;
|
|
@@ -36,7 +43,7 @@ type TailwindcssClassCache = Map<string, ({
|
|
|
36
43
|
options: Record<string, any>;
|
|
37
44
|
sort: Record<string, any>;
|
|
38
45
|
} | Rule)[]>;
|
|
39
|
-
|
|
46
|
+
interface TailwindcssRuntimeContext {
|
|
40
47
|
applyClassCache: Map<any, any>;
|
|
41
48
|
candidateRuleCache: Map<string | string, Set<[
|
|
42
49
|
{
|
|
@@ -73,7 +80,7 @@ type TailwindcssRuntimeContext = {
|
|
|
73
80
|
userConfigPath: string | null;
|
|
74
81
|
variantMap: Map<string, [[object, Function]]>;
|
|
75
82
|
variantOptions: Map<string, object>;
|
|
76
|
-
}
|
|
83
|
+
}
|
|
77
84
|
type DeepRequired<T> = {
|
|
78
85
|
[K in keyof T]: Required<DeepRequired<T[K]>>;
|
|
79
86
|
};
|
|
@@ -98,32 +105,26 @@ declare class TailwindcssPatcher {
|
|
|
98
105
|
patchOptions: InternalPatchOptions;
|
|
99
106
|
patch: () => void;
|
|
100
107
|
cacheManager: CacheManager;
|
|
108
|
+
packageInfo?: PackageInfo;
|
|
109
|
+
majorVersion?: number;
|
|
101
110
|
constructor(options?: TailwindcssPatcherOptions);
|
|
102
|
-
getPkgEntry(basedir?: string): string;
|
|
103
111
|
setCache(set: Set<string>): string | undefined;
|
|
104
112
|
getCache(): Set<string> | undefined;
|
|
113
|
+
getContexts(): TailwindcssRuntimeContext[];
|
|
114
|
+
getClassCaches(): TailwindcssClassCache[];
|
|
115
|
+
getClassCacheSet(options?: {
|
|
116
|
+
removeUniversalSelector?: boolean;
|
|
117
|
+
}): Set<string>;
|
|
105
118
|
/**
|
|
106
119
|
* @description 在多个 tailwindcss 上下文时,这个方法将被执行多次,所以策略上应该使用 append
|
|
107
|
-
* 详见 taro weapp-tailwindcss 独立分包
|
|
108
|
-
* @param basedir
|
|
109
|
-
* @returns
|
|
110
120
|
*/
|
|
111
121
|
getClassSet(options?: {
|
|
112
|
-
basedir?: string;
|
|
113
122
|
cacheStrategy?: CacheStrategy;
|
|
114
123
|
removeUniversalSelector?: boolean;
|
|
115
124
|
}): Set<string>;
|
|
116
|
-
getContexts(basedir?: string): TailwindcssRuntimeContext[];
|
|
117
125
|
extract(options?: UserConfig['patch']): Promise<string | undefined>;
|
|
118
126
|
}
|
|
119
127
|
|
|
120
|
-
declare function getTailwindcssEntry(basedir?: string): string;
|
|
121
|
-
declare function getContexts(basedir?: string): TailwindcssRuntimeContext[];
|
|
122
|
-
declare function getClassCaches(basedir?: string): TailwindcssClassCache[];
|
|
123
|
-
declare function getClassCacheSet(basedir?: string, options?: {
|
|
124
|
-
removeUniversalSelector?: boolean;
|
|
125
|
-
}): Set<string>;
|
|
126
|
-
|
|
127
128
|
declare function inspectProcessTailwindFeaturesReturnContext(content: string): {
|
|
128
129
|
code: string;
|
|
129
130
|
hasPatched: boolean;
|
|
@@ -133,10 +134,11 @@ declare function inspectPostcssPlugin(content: string): {
|
|
|
133
134
|
hasPatched: boolean;
|
|
134
135
|
};
|
|
135
136
|
|
|
136
|
-
declare function
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
137
|
+
declare function monkeyPatchForExposingContextV3(twDir: string, opt: InternalPatchOptions): {
|
|
138
|
+
processTailwindFeatures?: string | undefined;
|
|
139
|
+
plugin?: string | undefined;
|
|
140
|
+
} & Record<string, any>;
|
|
141
|
+
declare function monkeyPatchForExposingContextV2(twDir: string, opt: InternalPatchOptions): {
|
|
140
142
|
processTailwindFeatures?: string | undefined;
|
|
141
143
|
plugin?: string | undefined;
|
|
142
144
|
} & Record<string, any>;
|
|
@@ -145,5 +147,13 @@ declare function internalPatch(pkgJsonPath: string | undefined, options: Interna
|
|
|
145
147
|
declare function ensureFileContent(filepaths: string | string[]): string | undefined;
|
|
146
148
|
declare function requireResolve(id: string, opts?: SyncOpts): string;
|
|
147
149
|
declare function ensureDir(p: string): Promise<void>;
|
|
150
|
+
declare function getPackageInfoSync(name: string, options?: SyncOpts): {
|
|
151
|
+
name: string;
|
|
152
|
+
version: string | undefined;
|
|
153
|
+
rootPath: string;
|
|
154
|
+
packageJsonPath: string;
|
|
155
|
+
packageJson: PackageJson;
|
|
156
|
+
} | undefined;
|
|
157
|
+
declare function isObject(val: any): boolean;
|
|
148
158
|
|
|
149
|
-
export { CacheManager, type CacheOptions, type CacheStrategy, type DeepRequired, type InternalCacheOptions, type InternalPatchOptions, type PatchOptions, type TailwindcssClassCache, TailwindcssPatcher, type TailwindcssPatcherOptions, type TailwindcssRuntimeContext,
|
|
159
|
+
export { CacheManager, type CacheOptions, type CacheStrategy, type DeepRequired, type InternalCacheOptions, type InternalPatchOptions, type PackageInfo, type PatchOptions, type TailwindcssClassCache, TailwindcssPatcher, type TailwindcssPatcherOptions, type TailwindcssRuntimeContext, ensureDir, ensureFileContent, getCacheOptions, getPackageInfoSync, inspectPostcssPlugin, inspectProcessTailwindFeaturesReturnContext, internalPatch, isObject, monkeyPatchForExposingContextV2, monkeyPatchForExposingContextV3, requireResolve };
|
package/dist/index.d.ts
CHANGED
|
@@ -3,8 +3,15 @@ import { Config } from 'tailwindcss';
|
|
|
3
3
|
import { UserConfig } from '@tailwindcss-mangle/config';
|
|
4
4
|
export { defineConfig } from '@tailwindcss-mangle/config';
|
|
5
5
|
import { SyncOpts } from 'resolve';
|
|
6
|
+
import { PackageJson } from 'pkg-types';
|
|
6
7
|
|
|
7
8
|
type CacheStrategy = 'merge' | 'overwrite';
|
|
9
|
+
interface PackageInfo {
|
|
10
|
+
name: string;
|
|
11
|
+
version: string | undefined;
|
|
12
|
+
rootPath: string;
|
|
13
|
+
packageJsonPath: string;
|
|
14
|
+
}
|
|
8
15
|
interface CacheOptions {
|
|
9
16
|
dir?: string;
|
|
10
17
|
cwd?: string;
|
|
@@ -36,7 +43,7 @@ type TailwindcssClassCache = Map<string, ({
|
|
|
36
43
|
options: Record<string, any>;
|
|
37
44
|
sort: Record<string, any>;
|
|
38
45
|
} | Rule)[]>;
|
|
39
|
-
|
|
46
|
+
interface TailwindcssRuntimeContext {
|
|
40
47
|
applyClassCache: Map<any, any>;
|
|
41
48
|
candidateRuleCache: Map<string | string, Set<[
|
|
42
49
|
{
|
|
@@ -73,7 +80,7 @@ type TailwindcssRuntimeContext = {
|
|
|
73
80
|
userConfigPath: string | null;
|
|
74
81
|
variantMap: Map<string, [[object, Function]]>;
|
|
75
82
|
variantOptions: Map<string, object>;
|
|
76
|
-
}
|
|
83
|
+
}
|
|
77
84
|
type DeepRequired<T> = {
|
|
78
85
|
[K in keyof T]: Required<DeepRequired<T[K]>>;
|
|
79
86
|
};
|
|
@@ -98,32 +105,26 @@ declare class TailwindcssPatcher {
|
|
|
98
105
|
patchOptions: InternalPatchOptions;
|
|
99
106
|
patch: () => void;
|
|
100
107
|
cacheManager: CacheManager;
|
|
108
|
+
packageInfo?: PackageInfo;
|
|
109
|
+
majorVersion?: number;
|
|
101
110
|
constructor(options?: TailwindcssPatcherOptions);
|
|
102
|
-
getPkgEntry(basedir?: string): string;
|
|
103
111
|
setCache(set: Set<string>): string | undefined;
|
|
104
112
|
getCache(): Set<string> | undefined;
|
|
113
|
+
getContexts(): TailwindcssRuntimeContext[];
|
|
114
|
+
getClassCaches(): TailwindcssClassCache[];
|
|
115
|
+
getClassCacheSet(options?: {
|
|
116
|
+
removeUniversalSelector?: boolean;
|
|
117
|
+
}): Set<string>;
|
|
105
118
|
/**
|
|
106
119
|
* @description 在多个 tailwindcss 上下文时,这个方法将被执行多次,所以策略上应该使用 append
|
|
107
|
-
* 详见 taro weapp-tailwindcss 独立分包
|
|
108
|
-
* @param basedir
|
|
109
|
-
* @returns
|
|
110
120
|
*/
|
|
111
121
|
getClassSet(options?: {
|
|
112
|
-
basedir?: string;
|
|
113
122
|
cacheStrategy?: CacheStrategy;
|
|
114
123
|
removeUniversalSelector?: boolean;
|
|
115
124
|
}): Set<string>;
|
|
116
|
-
getContexts(basedir?: string): TailwindcssRuntimeContext[];
|
|
117
125
|
extract(options?: UserConfig['patch']): Promise<string | undefined>;
|
|
118
126
|
}
|
|
119
127
|
|
|
120
|
-
declare function getTailwindcssEntry(basedir?: string): string;
|
|
121
|
-
declare function getContexts(basedir?: string): TailwindcssRuntimeContext[];
|
|
122
|
-
declare function getClassCaches(basedir?: string): TailwindcssClassCache[];
|
|
123
|
-
declare function getClassCacheSet(basedir?: string, options?: {
|
|
124
|
-
removeUniversalSelector?: boolean;
|
|
125
|
-
}): Set<string>;
|
|
126
|
-
|
|
127
128
|
declare function inspectProcessTailwindFeaturesReturnContext(content: string): {
|
|
128
129
|
code: string;
|
|
129
130
|
hasPatched: boolean;
|
|
@@ -133,10 +134,11 @@ declare function inspectPostcssPlugin(content: string): {
|
|
|
133
134
|
hasPatched: boolean;
|
|
134
135
|
};
|
|
135
136
|
|
|
136
|
-
declare function
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
137
|
+
declare function monkeyPatchForExposingContextV3(twDir: string, opt: InternalPatchOptions): {
|
|
138
|
+
processTailwindFeatures?: string | undefined;
|
|
139
|
+
plugin?: string | undefined;
|
|
140
|
+
} & Record<string, any>;
|
|
141
|
+
declare function monkeyPatchForExposingContextV2(twDir: string, opt: InternalPatchOptions): {
|
|
140
142
|
processTailwindFeatures?: string | undefined;
|
|
141
143
|
plugin?: string | undefined;
|
|
142
144
|
} & Record<string, any>;
|
|
@@ -145,5 +147,13 @@ declare function internalPatch(pkgJsonPath: string | undefined, options: Interna
|
|
|
145
147
|
declare function ensureFileContent(filepaths: string | string[]): string | undefined;
|
|
146
148
|
declare function requireResolve(id: string, opts?: SyncOpts): string;
|
|
147
149
|
declare function ensureDir(p: string): Promise<void>;
|
|
150
|
+
declare function getPackageInfoSync(name: string, options?: SyncOpts): {
|
|
151
|
+
name: string;
|
|
152
|
+
version: string | undefined;
|
|
153
|
+
rootPath: string;
|
|
154
|
+
packageJsonPath: string;
|
|
155
|
+
packageJson: PackageJson;
|
|
156
|
+
} | undefined;
|
|
157
|
+
declare function isObject(val: any): boolean;
|
|
148
158
|
|
|
149
|
-
export { CacheManager, type CacheOptions, type CacheStrategy, type DeepRequired, type InternalCacheOptions, type InternalPatchOptions, type PatchOptions, type TailwindcssClassCache, TailwindcssPatcher, type TailwindcssPatcherOptions, type TailwindcssRuntimeContext,
|
|
159
|
+
export { CacheManager, type CacheOptions, type CacheStrategy, type DeepRequired, type InternalCacheOptions, type InternalPatchOptions, type PackageInfo, type PatchOptions, type TailwindcssClassCache, TailwindcssPatcher, type TailwindcssPatcherOptions, type TailwindcssRuntimeContext, ensureDir, ensureFileContent, getCacheOptions, getPackageInfoSync, inspectPostcssPlugin, inspectProcessTailwindFeaturesReturnContext, internalPatch, isObject, monkeyPatchForExposingContextV2, monkeyPatchForExposingContextV3, requireResolve };
|