tailwindcss-patch 7.1.1 → 7.1.2

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.
@@ -94,7 +94,7 @@ var logger = createConsola();
94
94
  var logger_default = logger;
95
95
 
96
96
  // src/core/cache.ts
97
- import process from "node:process";
97
+ import process from "process";
98
98
  import fs from "fs-extra";
99
99
  import path from "pathe";
100
100
 
@@ -171,7 +171,7 @@ var CacheManager = class {
171
171
  };
172
172
 
173
173
  // src/defaults.ts
174
- import process2 from "node:process";
174
+ import process2 from "process";
175
175
  function getDefaultPatchOptions() {
176
176
  return {
177
177
  packageName: "tailwindcss",
@@ -731,7 +731,7 @@ function monkeyPatchForSupportingCustomUnitV4(rootDir, options) {
731
731
  }
732
732
 
733
733
  // src/core/runtime.ts
734
- import { createRequire } from "node:module";
734
+ import { createRequire } from "module";
735
735
  import path4 from "pathe";
736
736
  import { gte } from "semver";
737
737
  var require2 = createRequire(import.meta.url);
@@ -780,14 +780,14 @@ function internalPatch(pkgJsonPath, options) {
780
780
  }
781
781
 
782
782
  // src/core/patcher.ts
783
- import { createRequire as createRequire3 } from "node:module";
784
- import process5 from "node:process";
783
+ import { createRequire as createRequire3 } from "module";
784
+ import process5 from "process";
785
785
  import fs4 from "fs-extra";
786
786
  import { getPackageInfoSync } from "local-pkg";
787
787
  import path6 from "pathe";
788
788
 
789
789
  // src/core/candidates.ts
790
- import process3 from "node:process";
790
+ import process3 from "process";
791
791
  function importNode() {
792
792
  return import("@tailwindcss/node");
793
793
  }
@@ -829,8 +829,8 @@ async function extractValidCandidates(options) {
829
829
  }
830
830
 
831
831
  // src/core/postcss.ts
832
- import { createRequire as createRequire2 } from "node:module";
833
- import process4 from "node:process";
832
+ import { createRequire as createRequire2 } from "module";
833
+ import process4 from "process";
834
834
  import path5 from "pathe";
835
835
  import postcss from "postcss";
836
836
  import { loadConfig } from "tailwindcss-config";
@@ -1052,7 +1052,8 @@ var TailwindcssPatcher = class {
1052
1052
  }
1053
1053
  return set;
1054
1054
  }
1055
- async extract() {
1055
+ async extract(options) {
1056
+ const { write } = defu(options, { write: true });
1056
1057
  const { output, tailwindcss } = this.patchOptions;
1057
1058
  if (output && tailwindcss) {
1058
1059
  const { filename, loose } = output;
@@ -1062,15 +1063,18 @@ var TailwindcssPatcher = class {
1062
1063
  majorVersion: this.majorVersion
1063
1064
  });
1064
1065
  }
1065
- const set = await this.getClassSet();
1066
+ const classSet = await this.getClassSet();
1066
1067
  if (filename) {
1067
- const classList = [...set];
1068
- await fs4.outputJSON(filename, classList, {
1069
- spaces: loose ? 2 : void 0
1070
- });
1068
+ const classList = [...classSet];
1069
+ if (write) {
1070
+ await fs4.outputJSON(filename, classList, {
1071
+ spaces: loose ? 2 : void 0
1072
+ });
1073
+ }
1071
1074
  return {
1072
1075
  filename,
1073
- classList
1076
+ classList,
1077
+ classSet
1074
1078
  };
1075
1079
  }
1076
1080
  }
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } var _class;// ../../node_modules/.pnpm/tsup@8.4.0_jiti@2.4.2_postcss@8.5.3_tsx@4.19.3_typescript@5.8.3_yaml@2.7.1/node_modules/tsup/assets/cjs_shims.js
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } var _class;// ../../node_modules/.pnpm/tsup@8.5.0_jiti@2.4.2_postcss@8.5.6_tsx@4.20.3_typescript@5.8.3_yaml@2.8.0/node_modules/tsup/assets/cjs_shims.js
2
2
  var getImportMetaUrl = () => typeof document === "undefined" ? new URL(`file:${__filename}`).href : document.currentScript && document.currentScript.src || new URL("main.js", document.baseURI).href;
3
3
  var importMetaUrl = /* @__PURE__ */ getImportMetaUrl();
4
4
 
@@ -1056,7 +1056,8 @@ var TailwindcssPatcher = (_class = class {
1056
1056
  }
1057
1057
  return set;
1058
1058
  }
1059
- async extract() {
1059
+ async extract(options) {
1060
+ const { write } = defu(options, { write: true });
1060
1061
  const { output, tailwindcss } = this.patchOptions;
1061
1062
  if (output && tailwindcss) {
1062
1063
  const { filename, loose } = output;
@@ -1066,15 +1067,18 @@ var TailwindcssPatcher = (_class = class {
1066
1067
  majorVersion: this.majorVersion
1067
1068
  });
1068
1069
  }
1069
- const set = await this.getClassSet();
1070
+ const classSet = await this.getClassSet();
1070
1071
  if (filename) {
1071
- const classList = [...set];
1072
- await _fsextra2.default.outputJSON(filename, classList, {
1073
- spaces: loose ? 2 : void 0
1074
- });
1072
+ const classList = [...classSet];
1073
+ if (write) {
1074
+ await _fsextra2.default.outputJSON(filename, classList, {
1075
+ spaces: loose ? 2 : void 0
1076
+ });
1077
+ }
1075
1078
  return {
1076
1079
  filename,
1077
- classList
1080
+ classList,
1081
+ classSet
1078
1082
  };
1079
1083
  }
1080
1084
  }
package/dist/cli.js CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
 
6
6
 
7
- var _chunkDULFDOL2js = require('./chunk-DULFDOL2.js');
7
+ var _chunkWNQ2OYR4js = require('./chunk-WNQ2OYR4.js');
8
8
 
9
9
  // src/cli.ts
10
10
  var _process = require('process'); var _process2 = _interopRequireDefault(_process);
@@ -16,26 +16,26 @@ function init() {
16
16
  }
17
17
  var cli = _cac2.default.call(void 0, );
18
18
  cli.command("install", "patch install").action(() => {
19
- const twPatcher = new (0, _chunkDULFDOL2js.TailwindcssPatcher)({
20
- patch: _chunkDULFDOL2js.getPatchOptions.call(void 0, )
19
+ const twPatcher = new (0, _chunkWNQ2OYR4js.TailwindcssPatcher)({
20
+ patch: _chunkWNQ2OYR4js.getPatchOptions.call(void 0, )
21
21
  });
22
22
  twPatcher.patch();
23
23
  });
24
24
  cli.command("init").action(async () => {
25
25
  await init();
26
- _chunkDULFDOL2js.logger_default.success(`\u2728 ${_config.CONFIG_NAME}.config.ts initialized!`);
26
+ _chunkWNQ2OYR4js.logger_default.success(`\u2728 ${_config.CONFIG_NAME}.config.ts initialized!`);
27
27
  });
28
28
  cli.command("extract").option("--css [file]", "css file entries").action(async (options) => {
29
29
  const { config } = await _config.getConfig.call(void 0, );
30
30
  const file = options.css;
31
31
  if (config) {
32
- const twPatcher = new (0, _chunkDULFDOL2js.TailwindcssPatcher)(
32
+ const twPatcher = new (0, _chunkWNQ2OYR4js.TailwindcssPatcher)(
33
33
  {
34
- patch: _chunkDULFDOL2js.defuOverrideArray.call(void 0,
34
+ patch: _chunkWNQ2OYR4js.defuOverrideArray.call(void 0,
35
35
  config.patch,
36
36
  {
37
37
  resolve: {
38
- paths: [_chunkDULFDOL2js.importMetaUrl]
38
+ paths: [_chunkWNQ2OYR4js.importMetaUrl]
39
39
  },
40
40
  tailwindcss: {
41
41
  v4: {
@@ -47,7 +47,7 @@ cli.command("extract").option("--css [file]", "css file entries").action(async (
47
47
  }
48
48
  );
49
49
  const p = await twPatcher.extract();
50
- p && _chunkDULFDOL2js.logger_default.success(`\u2728 tailwindcss-patch extract success! file path: ${p.filename}, classList length: ${p.classList.length}`);
50
+ p && _chunkWNQ2OYR4js.logger_default.success(`\u2728 tailwindcss-patch extract success! file path: ${p.filename}, classList length: ${p.classList.length}`);
51
51
  }
52
52
  });
53
53
  cli.help();
package/dist/cli.mjs CHANGED
@@ -3,10 +3,10 @@ import {
3
3
  defuOverrideArray,
4
4
  getPatchOptions,
5
5
  logger_default
6
- } from "./chunk-36H7NLND.mjs";
6
+ } from "./chunk-5PNNXDLA.mjs";
7
7
 
8
8
  // src/cli.ts
9
- import process from "node:process";
9
+ import process from "process";
10
10
  import { CONFIG_NAME, getConfig, initConfig } from "@tailwindcss-mangle/config";
11
11
  import cac from "cac";
12
12
  function init() {
package/dist/index.d.mts CHANGED
@@ -108,6 +108,9 @@ interface ExtractValidCandidatesOption {
108
108
  }
109
109
  declare function extractValidCandidates(options?: ExtractValidCandidatesOption): Promise<string[]>;
110
110
 
111
+ interface PatchExtractOptions {
112
+ write?: boolean;
113
+ }
111
114
  declare class TailwindcssPatcher {
112
115
  rawOptions: TailwindcssPatcherOptions;
113
116
  cacheOptions: InternalCacheOptions;
@@ -129,9 +132,10 @@ declare class TailwindcssPatcher {
129
132
  */
130
133
  getClassSet(): Promise<Set<string>>;
131
134
  getClassSetV3(): Set<string>;
132
- extract(): Promise<{
135
+ extract(options?: PatchExtractOptions): Promise<{
133
136
  filename: string;
134
137
  classList: string[];
138
+ classSet: Set<string>;
135
139
  } | undefined>;
136
140
  extractValidCandidates: typeof extractValidCandidates;
137
141
  }
@@ -157,4 +161,4 @@ declare function internalPatch(pkgJsonPath: string, options: InternalPatchOption
157
161
 
158
162
  declare const logger: consola.ConsolaInstance;
159
163
 
160
- export { CacheManager, type CacheOptions, type CacheStrategy, type DeepRequired, type ILengthUnitsPatchOptions, type InternalCacheOptions, type InternalPatchOptions, type PatchOptions, type TailwindcssClassCache, TailwindcssPatcher, type TailwindcssPatcherOptions, type TailwindcssRuntimeContext, getCacheOptions, internalPatch, logger, monkeyPatchForExposingContextV2, monkeyPatchForExposingContextV3, monkeyPatchForSupportingCustomUnitV3, monkeyPatchForSupportingCustomUnitV4 };
164
+ export { CacheManager, type CacheOptions, type CacheStrategy, type DeepRequired, type ILengthUnitsPatchOptions, type InternalCacheOptions, type InternalPatchOptions, type PatchExtractOptions, type PatchOptions, type TailwindcssClassCache, TailwindcssPatcher, type TailwindcssPatcherOptions, type TailwindcssRuntimeContext, getCacheOptions, internalPatch, logger, monkeyPatchForExposingContextV2, monkeyPatchForExposingContextV3, monkeyPatchForSupportingCustomUnitV3, monkeyPatchForSupportingCustomUnitV4 };
package/dist/index.d.ts CHANGED
@@ -108,6 +108,9 @@ interface ExtractValidCandidatesOption {
108
108
  }
109
109
  declare function extractValidCandidates(options?: ExtractValidCandidatesOption): Promise<string[]>;
110
110
 
111
+ interface PatchExtractOptions {
112
+ write?: boolean;
113
+ }
111
114
  declare class TailwindcssPatcher {
112
115
  rawOptions: TailwindcssPatcherOptions;
113
116
  cacheOptions: InternalCacheOptions;
@@ -129,9 +132,10 @@ declare class TailwindcssPatcher {
129
132
  */
130
133
  getClassSet(): Promise<Set<string>>;
131
134
  getClassSetV3(): Set<string>;
132
- extract(): Promise<{
135
+ extract(options?: PatchExtractOptions): Promise<{
133
136
  filename: string;
134
137
  classList: string[];
138
+ classSet: Set<string>;
135
139
  } | undefined>;
136
140
  extractValidCandidates: typeof extractValidCandidates;
137
141
  }
@@ -157,4 +161,4 @@ declare function internalPatch(pkgJsonPath: string, options: InternalPatchOption
157
161
 
158
162
  declare const logger: consola.ConsolaInstance;
159
163
 
160
- export { CacheManager, type CacheOptions, type CacheStrategy, type DeepRequired, type ILengthUnitsPatchOptions, type InternalCacheOptions, type InternalPatchOptions, type PatchOptions, type TailwindcssClassCache, TailwindcssPatcher, type TailwindcssPatcherOptions, type TailwindcssRuntimeContext, getCacheOptions, internalPatch, logger, monkeyPatchForExposingContextV2, monkeyPatchForExposingContextV3, monkeyPatchForSupportingCustomUnitV3, monkeyPatchForSupportingCustomUnitV4 };
164
+ export { CacheManager, type CacheOptions, type CacheStrategy, type DeepRequired, type ILengthUnitsPatchOptions, type InternalCacheOptions, type InternalPatchOptions, type PatchExtractOptions, type PatchOptions, type TailwindcssClassCache, TailwindcssPatcher, type TailwindcssPatcherOptions, type TailwindcssRuntimeContext, getCacheOptions, internalPatch, logger, monkeyPatchForExposingContextV2, monkeyPatchForExposingContextV3, monkeyPatchForSupportingCustomUnitV3, monkeyPatchForSupportingCustomUnitV4 };
package/dist/index.js CHANGED
@@ -8,7 +8,7 @@
8
8
 
9
9
 
10
10
 
11
- var _chunkDULFDOL2js = require('./chunk-DULFDOL2.js');
11
+ var _chunkWNQ2OYR4js = require('./chunk-WNQ2OYR4.js');
12
12
 
13
13
  // src/index.ts
14
14
  var _config = require('@tailwindcss-mangle/config');
@@ -23,4 +23,4 @@ var _config = require('@tailwindcss-mangle/config');
23
23
 
24
24
 
25
25
 
26
- exports.CacheManager = _chunkDULFDOL2js.CacheManager; exports.TailwindcssPatcher = _chunkDULFDOL2js.TailwindcssPatcher; exports.defineConfig = _config.defineConfig; exports.getCacheOptions = _chunkDULFDOL2js.getCacheOptions; exports.internalPatch = _chunkDULFDOL2js.internalPatch; exports.logger = _chunkDULFDOL2js.logger_default; exports.monkeyPatchForExposingContextV2 = _chunkDULFDOL2js.monkeyPatchForExposingContextV2; exports.monkeyPatchForExposingContextV3 = _chunkDULFDOL2js.monkeyPatchForExposingContextV3; exports.monkeyPatchForSupportingCustomUnitV3 = _chunkDULFDOL2js.monkeyPatchForSupportingCustomUnitV3; exports.monkeyPatchForSupportingCustomUnitV4 = _chunkDULFDOL2js.monkeyPatchForSupportingCustomUnitV4;
26
+ exports.CacheManager = _chunkWNQ2OYR4js.CacheManager; exports.TailwindcssPatcher = _chunkWNQ2OYR4js.TailwindcssPatcher; exports.defineConfig = _config.defineConfig; exports.getCacheOptions = _chunkWNQ2OYR4js.getCacheOptions; exports.internalPatch = _chunkWNQ2OYR4js.internalPatch; exports.logger = _chunkWNQ2OYR4js.logger_default; exports.monkeyPatchForExposingContextV2 = _chunkWNQ2OYR4js.monkeyPatchForExposingContextV2; exports.monkeyPatchForExposingContextV3 = _chunkWNQ2OYR4js.monkeyPatchForExposingContextV3; exports.monkeyPatchForSupportingCustomUnitV3 = _chunkWNQ2OYR4js.monkeyPatchForSupportingCustomUnitV3; exports.monkeyPatchForSupportingCustomUnitV4 = _chunkWNQ2OYR4js.monkeyPatchForSupportingCustomUnitV4;
package/dist/index.mjs CHANGED
@@ -8,7 +8,7 @@ import {
8
8
  monkeyPatchForExposingContextV3,
9
9
  monkeyPatchForSupportingCustomUnitV3,
10
10
  monkeyPatchForSupportingCustomUnitV4
11
- } from "./chunk-36H7NLND.mjs";
11
+ } from "./chunk-5PNNXDLA.mjs";
12
12
 
13
13
  // src/index.ts
14
14
  import { defineConfig } from "@tailwindcss-mangle/config";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tailwindcss-patch",
3
- "version": "7.1.1",
3
+ "version": "7.1.2",
4
4
  "description": "patch tailwindcss for exposing context and extract classes",
5
5
  "author": "ice breaker <1324318532@qq.com>",
6
6
  "license": "MIT",
@@ -50,28 +50,28 @@
50
50
  }
51
51
  },
52
52
  "dependencies": {
53
- "@babel/generator": "^7.27.0",
54
- "@babel/parser": "^7.27.0",
55
- "@babel/traverse": "^7.27.0",
56
- "@babel/types": "^7.27.0",
53
+ "@babel/generator": "^7.28.0",
54
+ "@babel/parser": "^7.28.0",
55
+ "@babel/traverse": "^7.28.0",
56
+ "@babel/types": "^7.28.1",
57
57
  "cac": "^6.7.14",
58
58
  "consola": "^3.4.2",
59
59
  "fs-extra": "^11.3.0",
60
60
  "local-pkg": "^1.1.1",
61
61
  "pathe": "^2.0.3",
62
- "postcss": "^8.5.3",
63
- "semver": "^7.7.1",
62
+ "postcss": "^8.5.6",
63
+ "semver": "^7.7.2",
64
64
  "tailwindcss-config": "^1.0.0",
65
- "@tailwindcss-mangle/config": "^5.1.0"
65
+ "@tailwindcss-mangle/config": "^5.1.1"
66
66
  },
67
67
  "devDependencies": {
68
- "@tailwindcss/node": "^4.1.4",
69
- "@tailwindcss/oxide": "^4.1.4",
70
- "@tailwindcss/postcss": "^4.1.4",
71
- "@tailwindcss/vite": "^4.1.4",
72
- "tailwindcss": "^4.1.1",
73
- "tailwindcss-3": "npm:tailwindcss@^3",
74
- "tailwindcss-4": "npm:tailwindcss@^4.1.1"
68
+ "@tailwindcss/node": "^4.1.11",
69
+ "@tailwindcss/oxide": "^4.1.11",
70
+ "@tailwindcss/postcss": "^4.1.11",
71
+ "@tailwindcss/vite": "^4.1.11",
72
+ "tailwindcss": "^4.1.11",
73
+ "tailwindcss-3": "npm:tailwindcss@^3.4.17",
74
+ "tailwindcss-4": "npm:tailwindcss@^4.1.11"
75
75
  },
76
76
  "scripts": {
77
77
  "dev": "tsup --watch --sourcemap",