tailwindcss-patch 9.4.3 → 9.5.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.
Files changed (36) hide show
  1. package/dist/{cli-BztQHMRp.js → cli-CGyUnvFc.js} +3 -2
  2. package/dist/{cli-D0jXMGXf.mjs → cli-DRfALTSo.mjs} +1 -1
  3. package/dist/cli.js +2 -2
  4. package/dist/cli.mjs +2 -2
  5. package/dist/commands/cli-runtime.d.mts +1 -1
  6. package/dist/commands/cli-runtime.d.ts +1 -1
  7. package/dist/commands/cli-runtime.js +2 -2
  8. package/dist/commands/cli-runtime.mjs +2 -2
  9. package/dist/{dist-DDcbvOwe.js → dist-DlC5vuI2.js} +1 -1
  10. package/dist/index.d.mts +7 -149
  11. package/dist/index.d.ts +8 -150
  12. package/dist/index.js +294 -521
  13. package/dist/index.mjs +6 -471
  14. package/dist/{validate-BuqRodYI.d.ts → validate-B5-08lrU.d.ts} +7 -251
  15. package/dist/{validate-oAkURzUC.d.mts → validate-CgrG4aAY.d.mts} +7 -251
  16. package/dist/{validate-Bug_WYcU.mjs → validate-Q00Ccqht.mjs} +8 -1405
  17. package/dist/{validate-DbuKewV-.js → validate-XiYmTZcd.js} +82 -1708
  18. package/package.json +8 -10
  19. package/src/api/tailwindcss-patcher.ts +8 -5
  20. package/src/extraction/candidate-extractor.ts +17 -701
  21. package/src/extraction/split-candidate-tokens.ts +5 -101
  22. package/src/options/types.ts +1 -2
  23. package/src/style-candidates.ts +5 -35
  24. package/src/style-generator.ts +11 -80
  25. package/src/types.ts +21 -95
  26. package/src/v3/index.ts +2 -2
  27. package/src/v4/index.ts +104 -28
  28. package/src/v3/style-generator.ts +0 -384
  29. package/src/v4/bare-arbitrary-values.ts +0 -545
  30. package/src/v4/candidates.ts +0 -316
  31. package/src/v4/engine.ts +0 -112
  32. package/src/v4/node-adapter.ts +0 -207
  33. package/src/v4/source-scan.ts +0 -432
  34. package/src/v4/source.ts +0 -235
  35. package/src/v4/style-generator.ts +0 -44
  36. package/src/v4/types.ts +0 -103
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "tailwindcss-patch",
3
- "version": "9.4.3",
3
+ "version": "9.5.0",
4
4
  "description": "patch tailwindcss for exposing context and extract classes",
5
5
  "author": "ice breaker <1324318532@qq.com>",
6
6
  "license": "MIT",
7
7
  "engines": {
8
- "node": ">=18.0.0"
8
+ "node": ">=22.13.0"
9
9
  },
10
10
  "homepage": "https://mangle.icebreaker.top/",
11
11
  "repository": {
@@ -65,25 +65,23 @@
65
65
  "@babel/parser": "^7.29.7",
66
66
  "@babel/traverse": "^7.29.7",
67
67
  "@babel/types": "^7.29.7",
68
- "@tailwindcss/node": "^4.3.0",
69
- "@tailwindcss/oxide": "^4.3.0",
70
68
  "cac": "6.7.14",
71
69
  "consola": "^3.4.2",
72
70
  "fs-extra": "^11.3.5",
73
71
  "local-pkg": "^1.2.1",
74
- "micromatch": "^4.0.8",
75
72
  "pathe": "^2.0.3",
76
73
  "postcss": "^8.5.15",
77
74
  "semver": "^7.8.4",
78
75
  "tailwindcss-config": "^2.0.0",
79
- "@tailwindcss-mangle/config": "7.0.2"
76
+ "@tailwindcss-mangle/config": "7.0.2",
77
+ "@tailwindcss-mangle/engine": "0.1.0"
80
78
  },
81
79
  "devDependencies": {
82
- "@tailwindcss/postcss": "^4.3.0",
83
- "@tailwindcss/vite": "^4.3.0",
84
- "tailwindcss": "^4.3.0",
80
+ "@tailwindcss/postcss": "^4.3.1",
81
+ "@tailwindcss/vite": "^4.3.1",
82
+ "tailwindcss": "^4.3.1",
85
83
  "tailwindcss-3": "npm:tailwindcss@^3.4.19",
86
- "tailwindcss-4": "npm:tailwindcss@^4.3.0"
84
+ "tailwindcss-4": "npm:tailwindcss@^4.3.1"
87
85
  },
88
86
  "scripts": {
89
87
  "dev": "tsdown --watch --sourcemap",
@@ -1,4 +1,4 @@
1
- import type { SourceEntry } from '@tailwindcss/oxide'
1
+ import type { TailwindV4SourcePattern as SourceEntry } from '@tailwindcss-mangle/engine/v4'
2
2
  import type { PackageInfo } from 'local-pkg'
3
3
  import type { NormalizedTailwindCssPatchOptions } from '../config'
4
4
  import type { PatchResult, TailwindCollector, TailwindMajorVersion } from '../runtime/collector'
@@ -9,6 +9,7 @@ import type {
9
9
  CacheReadMeta,
10
10
  ExtractResult,
11
11
  TailwindCssPatchOptions,
12
+ TailwindcssRuntimeContext,
12
13
  TailwindTokenByFileMap,
13
14
  TailwindTokenFileKey,
14
15
  TailwindTokenReport,
@@ -104,9 +105,11 @@ function createCollector(
104
105
  return new RuntimeCollector(packageInfo, options, majorVersion, snapshotFactory)
105
106
  }
106
107
 
107
- function getPackageInfoFromCwd(packageName: string, cwd: string): PackageInfo | undefined {
108
+ function getPackageInfoFromCwd(packageName: string, cwd: string, resolvePaths: string[] = []): PackageInfo | undefined {
108
109
  try {
109
- const packageJsonPath = createRequire(path.join(cwd, 'package.json')).resolve(`${packageName}/package.json`)
110
+ const packageJsonPath = createRequire(path.join(cwd, 'package.json')).resolve(`${packageName}/package.json`, {
111
+ paths: resolvePaths,
112
+ })
110
113
  const packageJson = fs.readJSONSync(packageJsonPath) as PackageInfo['packageJson']
111
114
  return {
112
115
  name: packageName,
@@ -124,7 +127,7 @@ function getPackageInfoFromCwd(packageName: string, cwd: string): PackageInfo |
124
127
  function getTailwindPackageInfo(options: NormalizedTailwindCssPatchOptions) {
125
128
  const cwd = options.tailwind.cwd ?? options.projectRoot
126
129
  const cwdPackageInfo = options.tailwind.resolve?.paths?.length
127
- ? getPackageInfoFromCwd(options.tailwind.packageName, cwd)
130
+ ? getPackageInfoFromCwd(options.tailwind.packageName, cwd, options.tailwind.resolve.paths)
128
131
  : undefined
129
132
  return cwdPackageInfo
130
133
  ?? getPackageInfoSync(
@@ -194,7 +197,7 @@ export class TailwindcssPatcher {
194
197
  return this.collector.getPatchStatus()
195
198
  }
196
199
 
197
- getContexts() {
200
+ getContexts(): TailwindcssRuntimeContext[] {
198
201
  return this.collector.getContexts()
199
202
  }
200
203