tailwindcss-patch 5.0.2 → 6.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/dist/cli.js CHANGED
@@ -1,34 +1,34 @@
1
- import {
2
- TailwindcssPatcher,
3
- config_exports,
4
- getPatchOptions,
5
- logger_default
6
- } from "./chunk-LOQK6LST.js";
1
+ "use strict"; function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
2
+
3
+
4
+
5
+ var _chunkP7C42UCOjs = require('./chunk-P7C42UCO.js');
7
6
 
8
7
  // src/cli.ts
9
- import process from "node:process";
10
- import cac from "cac";
8
+ var _process = require('process'); var _process2 = _interopRequireDefault(_process);
9
+ var _config = require('@tailwindcss-mangle/config');
10
+ var _cac = require('cac'); var _cac2 = _interopRequireDefault(_cac);
11
11
  function init() {
12
- const cwd = process.cwd();
13
- return (0, config_exports.initConfig)(cwd);
12
+ const cwd = _process2.default.cwd();
13
+ return _config.initConfig.call(void 0, cwd);
14
14
  }
15
- var cli = cac();
15
+ var cli = _cac2.default.call(void 0, );
16
16
  cli.command("install", "patch install").action(() => {
17
- const twPatcher = new TailwindcssPatcher({
18
- patch: getPatchOptions()
17
+ const twPatcher = new (0, _chunkP7C42UCOjs.TailwindcssPatcher)({
18
+ patch: _chunkP7C42UCOjs.getPatchOptions.call(void 0, )
19
19
  });
20
20
  twPatcher.patch();
21
21
  });
22
22
  cli.command("init").action(async () => {
23
23
  await init();
24
- logger_default.success(`\u2728 ${config_exports.configName}.config.ts initialized!`);
24
+ _chunkP7C42UCOjs.logger_default.success(`\u2728 ${_config.CONFIG_NAME}.config.ts initialized!`);
25
25
  });
26
26
  cli.command("extract").action(async () => {
27
- const { config } = await (0, config_exports.getConfig)();
27
+ const { config } = await _config.getConfig.call(void 0, );
28
28
  if (config) {
29
- const twPatcher = new TailwindcssPatcher();
29
+ const twPatcher = new (0, _chunkP7C42UCOjs.TailwindcssPatcher)();
30
30
  const p = await twPatcher.extract(config.patch);
31
- logger_default.success(`\u2728 tailwindcss-patch extract success! file path: ${p}`);
31
+ _chunkP7C42UCOjs.logger_default.success(`\u2728 tailwindcss-patch extract success! file path: ${p}`);
32
32
  }
33
33
  });
34
34
  cli.help();
package/dist/cli.mjs ADDED
@@ -0,0 +1,35 @@
1
+ import {
2
+ TailwindcssPatcher,
3
+ getPatchOptions,
4
+ logger_default
5
+ } from "./chunk-AZHCF3SW.mjs";
6
+
7
+ // src/cli.ts
8
+ import process from "node:process";
9
+ import { CONFIG_NAME, getConfig, initConfig } from "@tailwindcss-mangle/config";
10
+ import cac from "cac";
11
+ function init() {
12
+ const cwd = process.cwd();
13
+ return initConfig(cwd);
14
+ }
15
+ var cli = cac();
16
+ cli.command("install", "patch install").action(() => {
17
+ const twPatcher = new TailwindcssPatcher({
18
+ patch: getPatchOptions()
19
+ });
20
+ twPatcher.patch();
21
+ });
22
+ cli.command("init").action(async () => {
23
+ await init();
24
+ logger_default.success(`\u2728 ${CONFIG_NAME}.config.ts initialized!`);
25
+ });
26
+ cli.command("extract").action(async () => {
27
+ const { config } = await getConfig();
28
+ if (config) {
29
+ const twPatcher = new TailwindcssPatcher();
30
+ const p = await twPatcher.extract(config.patch);
31
+ logger_default.success(`\u2728 tailwindcss-patch extract success! file path: ${p}`);
32
+ }
33
+ });
34
+ cli.help();
35
+ cli.parse();
@@ -1,7 +1,8 @@
1
- import { UserConfig } from '@tailwindcss-mangle/config';
2
- export { defineConfig } from '@tailwindcss-mangle/config';
3
- import { Rule, Node } from 'postcss';
1
+ import { Node, Rule } from 'postcss';
4
2
  import { Config } from 'tailwindcss';
3
+ import { PatchUserConfig } from '@tailwindcss-mangle/config';
4
+ export { defineConfig } from '@tailwindcss-mangle/config';
5
+ import { GlobEntry } from '@tailwindcss/oxide';
5
6
  import * as consola from 'consola';
6
7
 
7
8
  type CacheStrategy = 'merge' | 'overwrite';
@@ -43,7 +44,7 @@ type TailwindcssClassCache = Map<string, ({
43
44
  } | Rule)[]>;
44
45
  interface TailwindcssRuntimeContext {
45
46
  applyClassCache: Map<any, any>;
46
- candidateRuleCache: Map<string | string, Set<[
47
+ candidateRuleCache: Map<string, Set<[
47
48
  {
48
49
  arbitrary: any;
49
50
  index: any;
@@ -103,30 +104,33 @@ declare class CacheManager {
103
104
  read(): Set<string> | undefined;
104
105
  }
105
106
 
107
+ interface ExtractValidCandidatesOption {
108
+ sources?: GlobEntry[];
109
+ base?: string;
110
+ css?: string;
111
+ }
112
+ declare function extractValidCandidates(options?: ExtractValidCandidatesOption): Promise<string[]>;
113
+
106
114
  declare class TailwindcssPatcher {
107
115
  rawOptions: TailwindcssPatcherOptions;
108
116
  cacheOptions: InternalCacheOptions;
109
117
  patchOptions: InternalPatchOptions;
110
118
  patch: () => void;
111
119
  cacheManager: CacheManager;
112
- packageInfo?: PackageInfo;
120
+ packageInfo: PackageInfo;
113
121
  majorVersion?: number;
114
122
  constructor(options?: TailwindcssPatcherOptions);
115
123
  setCache(set: Set<string>): string | undefined;
116
124
  getCache(): Set<string> | undefined;
117
125
  getContexts(): TailwindcssRuntimeContext[];
118
126
  getClassCaches(): TailwindcssClassCache[];
119
- getClassCacheSet(options?: {
120
- removeUniversalSelector?: boolean;
121
- }): Set<string>;
127
+ getClassCacheSet(options?: PatchUserConfig): Promise<Set<string>>;
122
128
  /**
123
129
  * @description 在多个 tailwindcss 上下文时,这个方法将被执行多次,所以策略上应该使用 append
124
130
  */
125
- getClassSet(options?: {
126
- cacheStrategy?: CacheStrategy;
127
- removeUniversalSelector?: boolean;
128
- }): Set<string>;
129
- extract(options?: UserConfig['patch']): Promise<string | undefined>;
131
+ getClassSet(options?: PatchUserConfig): Promise<Set<string>>;
132
+ extract(options?: PatchUserConfig): Promise<string | undefined>;
133
+ extractValidCandidates: typeof extractValidCandidates;
130
134
  }
131
135
 
132
136
  declare function monkeyPatchForExposingContextV3(twDir: string, opt: InternalPatchOptions): Record<string, any> | undefined;
package/dist/index.d.ts CHANGED
@@ -1,7 +1,8 @@
1
- import { UserConfig } from '@tailwindcss-mangle/config';
2
- export { defineConfig } from '@tailwindcss-mangle/config';
3
- import { Rule, Node } from 'postcss';
1
+ import { Node, Rule } from 'postcss';
4
2
  import { Config } from 'tailwindcss';
3
+ import { PatchUserConfig } from '@tailwindcss-mangle/config';
4
+ export { defineConfig } from '@tailwindcss-mangle/config';
5
+ import { GlobEntry } from '@tailwindcss/oxide';
5
6
  import * as consola from 'consola';
6
7
 
7
8
  type CacheStrategy = 'merge' | 'overwrite';
@@ -43,7 +44,7 @@ type TailwindcssClassCache = Map<string, ({
43
44
  } | Rule)[]>;
44
45
  interface TailwindcssRuntimeContext {
45
46
  applyClassCache: Map<any, any>;
46
- candidateRuleCache: Map<string | string, Set<[
47
+ candidateRuleCache: Map<string, Set<[
47
48
  {
48
49
  arbitrary: any;
49
50
  index: any;
@@ -103,30 +104,33 @@ declare class CacheManager {
103
104
  read(): Set<string> | undefined;
104
105
  }
105
106
 
107
+ interface ExtractValidCandidatesOption {
108
+ sources?: GlobEntry[];
109
+ base?: string;
110
+ css?: string;
111
+ }
112
+ declare function extractValidCandidates(options?: ExtractValidCandidatesOption): Promise<string[]>;
113
+
106
114
  declare class TailwindcssPatcher {
107
115
  rawOptions: TailwindcssPatcherOptions;
108
116
  cacheOptions: InternalCacheOptions;
109
117
  patchOptions: InternalPatchOptions;
110
118
  patch: () => void;
111
119
  cacheManager: CacheManager;
112
- packageInfo?: PackageInfo;
120
+ packageInfo: PackageInfo;
113
121
  majorVersion?: number;
114
122
  constructor(options?: TailwindcssPatcherOptions);
115
123
  setCache(set: Set<string>): string | undefined;
116
124
  getCache(): Set<string> | undefined;
117
125
  getContexts(): TailwindcssRuntimeContext[];
118
126
  getClassCaches(): TailwindcssClassCache[];
119
- getClassCacheSet(options?: {
120
- removeUniversalSelector?: boolean;
121
- }): Set<string>;
127
+ getClassCacheSet(options?: PatchUserConfig): Promise<Set<string>>;
122
128
  /**
123
129
  * @description 在多个 tailwindcss 上下文时,这个方法将被执行多次,所以策略上应该使用 append
124
130
  */
125
- getClassSet(options?: {
126
- cacheStrategy?: CacheStrategy;
127
- removeUniversalSelector?: boolean;
128
- }): Set<string>;
129
- extract(options?: UserConfig['patch']): Promise<string | undefined>;
131
+ getClassSet(options?: PatchUserConfig): Promise<Set<string>>;
132
+ extract(options?: PatchUserConfig): Promise<string | undefined>;
133
+ extractValidCandidates: typeof extractValidCandidates;
130
134
  }
131
135
 
132
136
  declare function monkeyPatchForExposingContextV3(twDir: string, opt: InternalPatchOptions): Record<string, any> | undefined;
package/dist/index.js CHANGED
@@ -1,23 +1,24 @@
1
- import {
2
- CacheManager,
3
- TailwindcssPatcher,
4
- config_exports,
5
- getCacheOptions,
6
- internalPatch,
7
- logger_default,
8
- monkeyPatchForExposingContextV2,
9
- monkeyPatchForExposingContextV3,
10
- monkeyPatchForSupportingCustomUnit
11
- } from "./chunk-LOQK6LST.js";
12
- var export_defineConfig = config_exports.defineConfig;
13
- export {
14
- CacheManager,
15
- TailwindcssPatcher,
16
- export_defineConfig as defineConfig,
17
- getCacheOptions,
18
- internalPatch,
19
- logger_default as logger,
20
- monkeyPatchForExposingContextV2,
21
- monkeyPatchForExposingContextV3,
22
- monkeyPatchForSupportingCustomUnit
23
- };
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
+
3
+
4
+
5
+
6
+
7
+
8
+
9
+
10
+ var _chunkP7C42UCOjs = require('./chunk-P7C42UCO.js');
11
+
12
+ // src/index.ts
13
+ var _config = require('@tailwindcss-mangle/config');
14
+
15
+
16
+
17
+
18
+
19
+
20
+
21
+
22
+
23
+
24
+ exports.CacheManager = _chunkP7C42UCOjs.CacheManager; exports.TailwindcssPatcher = _chunkP7C42UCOjs.TailwindcssPatcher; exports.defineConfig = _config.defineConfig; exports.getCacheOptions = _chunkP7C42UCOjs.getCacheOptions; exports.internalPatch = _chunkP7C42UCOjs.internalPatch; exports.logger = _chunkP7C42UCOjs.logger_default; exports.monkeyPatchForExposingContextV2 = _chunkP7C42UCOjs.monkeyPatchForExposingContextV2; exports.monkeyPatchForExposingContextV3 = _chunkP7C42UCOjs.monkeyPatchForExposingContextV3; exports.monkeyPatchForSupportingCustomUnit = _chunkP7C42UCOjs.monkeyPatchForSupportingCustomUnit;
package/dist/index.mjs ADDED
@@ -0,0 +1,24 @@
1
+ import {
2
+ CacheManager,
3
+ TailwindcssPatcher,
4
+ getCacheOptions,
5
+ internalPatch,
6
+ logger_default,
7
+ monkeyPatchForExposingContextV2,
8
+ monkeyPatchForExposingContextV3,
9
+ monkeyPatchForSupportingCustomUnit
10
+ } from "./chunk-AZHCF3SW.mjs";
11
+
12
+ // src/index.ts
13
+ import { defineConfig } from "@tailwindcss-mangle/config";
14
+ export {
15
+ CacheManager,
16
+ TailwindcssPatcher,
17
+ defineConfig,
18
+ getCacheOptions,
19
+ internalPatch,
20
+ logger_default as logger,
21
+ monkeyPatchForExposingContextV2,
22
+ monkeyPatchForExposingContextV3,
23
+ monkeyPatchForSupportingCustomUnit
24
+ };
package/package.json CHANGED
@@ -1,7 +1,6 @@
1
1
  {
2
2
  "name": "tailwindcss-patch",
3
- "type": "module",
4
- "version": "5.0.2",
3
+ "version": "6.0.0",
5
4
  "description": "patch tailwindcss for exposing context and extract classes",
6
5
  "author": "ice breaker <1324318532@qq.com>",
7
6
  "license": "MIT",
@@ -23,12 +22,12 @@
23
22
  "exports": {
24
23
  ".": {
25
24
  "types": "./dist/index.d.ts",
26
- "import": "./dist/index.js",
27
- "require": "./dist/index.cjs"
25
+ "import": "./dist/index.mjs",
26
+ "require": "./dist/index.js"
28
27
  }
29
28
  },
30
- "main": "./dist/index.cjs",
31
- "module": "./dist/index.js",
29
+ "main": "./dist/index.js",
30
+ "module": "./dist/index.mjs",
32
31
  "types": "./dist/index.d.ts",
33
32
  "bin": {
34
33
  "tw-patch": "bin/tw-patch.js",
@@ -51,20 +50,28 @@
51
50
  }
52
51
  },
53
52
  "dependencies": {
54
- "@babel/generator": "^7.26.2",
55
- "@babel/parser": "^7.26.2",
56
- "@babel/traverse": "^7.25.9",
57
- "@babel/types": "^7.26.0",
53
+ "@babel/generator": "^7.26.9",
54
+ "@babel/parser": "^7.26.9",
55
+ "@babel/traverse": "^7.26.9",
56
+ "@babel/types": "^7.26.9",
58
57
  "cac": "^6.7.14",
59
- "consola": "^3.2.3",
60
- "fs-extra": "^11.2.0",
61
- "jiti": "^2.4.0",
62
- "lilconfig": "^3.1.2",
63
- "pathe": "^1.1.2",
64
- "postcss": "^8.4.47",
65
- "resolve": "^1.22.8",
66
- "semver": "^7.6.3",
67
- "@tailwindcss-mangle/config": "^4.0.1"
58
+ "consola": "^3.4.0",
59
+ "fs-extra": "^11.3.0",
60
+ "local-pkg": "^1.0.0",
61
+ "pathe": "^2.0.3",
62
+ "postcss": "^8.5.2",
63
+ "semver": "^7.7.1",
64
+ "tailwindcss-config": "^1.0.0",
65
+ "@tailwindcss-mangle/config": "^5.0.0"
66
+ },
67
+ "devDependencies": {
68
+ "@tailwindcss/node": "^4.0.6",
69
+ "@tailwindcss/oxide": "^4.0.6",
70
+ "@tailwindcss/postcss": "^4.0.6",
71
+ "@tailwindcss/vite": "^4.0.6",
72
+ "tailwindcss": "^4.0.6",
73
+ "tailwindcss-3": "npm:tailwindcss@^3",
74
+ "tailwindcss-4": "npm:tailwindcss@^4"
68
75
  },
69
76
  "scripts": {
70
77
  "dev": "tsup --watch --sourcemap",