tailwindcss-patch 7.1.1 → 7.1.3

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,27 +1052,34 @@ 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
- if (output && tailwindcss) {
1058
- const { filename, loose } = output;
1058
+ if (tailwindcss) {
1059
1059
  if (this.majorVersion === 3 || this.majorVersion === 2) {
1060
1060
  await processTailwindcss({
1061
1061
  ...tailwindcss,
1062
1062
  majorVersion: this.majorVersion
1063
1063
  });
1064
1064
  }
1065
- const set = await this.getClassSet();
1066
- if (filename) {
1067
- const classList = [...set];
1068
- await fs4.outputJSON(filename, classList, {
1069
- spaces: loose ? 2 : void 0
1070
- });
1071
- return {
1072
- filename,
1073
- classList
1074
- };
1065
+ const classSet = await this.getClassSet();
1066
+ const classList = [...classSet];
1067
+ const result = {
1068
+ classList,
1069
+ classSet
1070
+ };
1071
+ if (output) {
1072
+ const { filename, loose } = output;
1073
+ if (filename) {
1074
+ if (write) {
1075
+ await fs4.outputJSON(filename, classList, {
1076
+ spaces: loose ? 2 : void 0
1077
+ });
1078
+ }
1079
+ result.filename = filename;
1080
+ }
1075
1081
  }
1082
+ return result;
1076
1083
  }
1077
1084
  }
1078
1085
  extractValidCandidates = extractValidCandidates;
@@ -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,27 +1056,34 @@ 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
- if (output && tailwindcss) {
1062
- const { filename, loose } = output;
1062
+ if (tailwindcss) {
1063
1063
  if (this.majorVersion === 3 || this.majorVersion === 2) {
1064
1064
  await processTailwindcss({
1065
1065
  ...tailwindcss,
1066
1066
  majorVersion: this.majorVersion
1067
1067
  });
1068
1068
  }
1069
- const set = await this.getClassSet();
1070
- if (filename) {
1071
- const classList = [...set];
1072
- await _fsextra2.default.outputJSON(filename, classList, {
1073
- spaces: loose ? 2 : void 0
1074
- });
1075
- return {
1076
- filename,
1077
- classList
1078
- };
1069
+ const classSet = await this.getClassSet();
1070
+ const classList = [...classSet];
1071
+ const result = {
1072
+ classList,
1073
+ classSet
1074
+ };
1075
+ if (output) {
1076
+ const { filename, loose } = output;
1077
+ if (filename) {
1078
+ if (write) {
1079
+ await _fsextra2.default.outputJSON(filename, classList, {
1080
+ spaces: loose ? 2 : void 0
1081
+ });
1082
+ }
1083
+ result.filename = filename;
1084
+ }
1079
1085
  }
1086
+ return result;
1080
1087
  }
1081
1088
  }
1082
1089
  __init() {this.extractValidCandidates = extractValidCandidates}
package/dist/cli.js CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
 
6
6
 
7
- var _chunkDULFDOL2js = require('./chunk-DULFDOL2.js');
7
+ var _chunkZB7IRGF6js = require('./chunk-ZB7IRGF6.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, _chunkZB7IRGF6js.TailwindcssPatcher)({
20
+ patch: _chunkZB7IRGF6js.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
+ _chunkZB7IRGF6js.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, _chunkZB7IRGF6js.TailwindcssPatcher)(
33
33
  {
34
- patch: _chunkDULFDOL2js.defuOverrideArray.call(void 0,
34
+ patch: _chunkZB7IRGF6js.defuOverrideArray.call(void 0,
35
35
  config.patch,
36
36
  {
37
37
  resolve: {
38
- paths: [_chunkDULFDOL2js.importMetaUrl]
38
+ paths: [_chunkZB7IRGF6js.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 && _chunkZB7IRGF6js.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-WQACRZUK.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<{
133
- filename: string;
135
+ extract(options?: PatchExtractOptions): Promise<{
134
136
  classList: string[];
137
+ classSet: Set<string>;
138
+ filename?: 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<{
133
- filename: string;
135
+ extract(options?: PatchExtractOptions): Promise<{
134
136
  classList: string[];
137
+ classSet: Set<string>;
138
+ filename?: 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 _chunkZB7IRGF6js = require('./chunk-ZB7IRGF6.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 = _chunkZB7IRGF6js.CacheManager; exports.TailwindcssPatcher = _chunkZB7IRGF6js.TailwindcssPatcher; exports.defineConfig = _config.defineConfig; exports.getCacheOptions = _chunkZB7IRGF6js.getCacheOptions; exports.internalPatch = _chunkZB7IRGF6js.internalPatch; exports.logger = _chunkZB7IRGF6js.logger_default; exports.monkeyPatchForExposingContextV2 = _chunkZB7IRGF6js.monkeyPatchForExposingContextV2; exports.monkeyPatchForExposingContextV3 = _chunkZB7IRGF6js.monkeyPatchForExposingContextV3; exports.monkeyPatchForSupportingCustomUnitV3 = _chunkZB7IRGF6js.monkeyPatchForSupportingCustomUnitV3; exports.monkeyPatchForSupportingCustomUnitV4 = _chunkZB7IRGF6js.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-WQACRZUK.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.3",
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",