Skip to content

Commit

Permalink
chore: bump version
Browse files Browse the repository at this point in the history
  • Loading branch information
sonofmagic committed Mar 3, 2025
1 parent d9d646d commit 5618019
Show file tree
Hide file tree
Showing 12 changed files with 157 additions and 85 deletions.
5 changes: 5 additions & 0 deletions .changeset/poor-islands-stick.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"weapp-tailwindcss": patch
---

fix: 添加 TailwindcssPatcherOptions 给更高程度的自定义策略
5 changes: 5 additions & 0 deletions .changeset/seven-places-drum.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@weapp-tailwindcss/merge": patch
---

chore: 升级相关的依赖
2 changes: 1 addition & 1 deletion apps/web-postcss7-compat/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"postinstall": "weapp-tw patch"
},
"dependencies": {
"tailwindcss-patch": "^7.0.1"
"tailwindcss-patch": "^7.0.2"
},
"devDependencies": {
"autoprefixer": "^9.8.8",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@
"postcss-loader": "^8.1.1",
"postcss-preset-env": "^10.1.5",
"postcss-scss": "^4.0.9",
"prettier": "^3.5.2",
"prettier": "^3.5.3",
"promisify-loader-runner": "^1.0.1",
"rimraf": "^6.0.1",
"rollup": "^4.34.9",
Expand Down
2 changes: 1 addition & 1 deletion packages/merge/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
"dependencies": {
"class-variance-authority": "^0.7.1",
"clsx": "^2.1.1",
"local-pkg": "^1.1.0",
"local-pkg": "^1.1.1",
"semver": "^7.7.1",
"tailwind-merge": "^3.0.2",
"tailwind-merge-v2": "npm:tailwind-merge@^2.6.0"
Expand Down
4 changes: 2 additions & 2 deletions packages/weapp-tailwindcss/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -174,12 +174,12 @@
"debug": "~4.4.0",
"htmlparser2": "10.0.0",
"loader-utils": "2.0.4",
"local-pkg": "^1.1.0",
"local-pkg": "^1.1.1",
"lru-cache": "10.4.3",
"magic-string": "0.30.17",
"md5": "2.3.0",
"semver": "~7.7.1",
"tailwindcss-patch": "~7.0.1",
"tailwindcss-patch": "~7.0.2",
"webpack-sources": "3.2.3"
}
}
4 changes: 2 additions & 2 deletions packages/weapp-tailwindcss/src/context/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export function getCompilerContext(opts?: UserDefinedOptions): InternalUserDefin
ignoreTaggedTemplateExpressionIdentifiers,
cssPresetEnv,
tailwindcss,
patch,
tailwindcssPatcherOptions,
} = ctx

const customAttributesEntities: ICustomAttributesEntities = isMap(customAttributes)
Expand Down Expand Up @@ -109,7 +109,7 @@ export function getCompilerContext(opts?: UserDefinedOptions): InternalUserDefin
cacheDir: appType === 'mpx' ? 'node_modules/tailwindcss-patch/.cache' : undefined,
supportCustomLengthUnitsPatch: supportCustomLengthUnitsPatch ?? true,
tailwindcss,
patch,
tailwindcssPatcherOptions,
},
)
ctx.setMangleRuntimeSet = setMangleRuntimeSet
Expand Down
8 changes: 5 additions & 3 deletions packages/weapp-tailwindcss/src/defaults.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,11 @@ export function getDefaultOptions(): UserDefinedOptions {
cssRemoveHoverPseudoClass: true,
ignoreCallExpressionIdentifiers: isPackageExists('@weapp-tailwindcss/merge') ? ['twMerge', 'twJoin', 'cva'] : [],
ignoreTaggedTemplateExpressionIdentifiers: ['weappTwIgnore'],
patch: {
filter(className) {
return !isAllowedClassName(className)
tailwindcssPatcherOptions: {
patch: {
filter(className) {
return !isAllowedClassName(className)
},
},
},
}
Expand Down
42 changes: 21 additions & 21 deletions packages/weapp-tailwindcss/src/tailwindcss/patcher.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { CacheOptions, ILengthUnitsPatchOptions, PatchOptions, TailwindcssUserConfig } from 'tailwindcss-patch'
import type { CacheOptions, ILengthUnitsPatchOptions, TailwindcssPatcherOptions, TailwindcssUserConfig } from 'tailwindcss-patch'
import path from 'node:path'
import process from 'node:process'
import { defuOverrideArray } from '@weapp-tailwindcss/shared'
Expand All @@ -9,11 +9,11 @@ export interface CreateTailwindcssPatcherOptions {
cacheDir?: string
supportCustomLengthUnitsPatch?: boolean | ILengthUnitsPatchOptions
tailwindcss?: TailwindcssUserConfig
patch?: PatchOptions
tailwindcssPatcherOptions?: TailwindcssPatcherOptions
}

export function createTailwindcssPatcher(options?: CreateTailwindcssPatcherOptions) {
const { basedir, cacheDir, supportCustomLengthUnitsPatch, tailwindcss, patch } = options || {}
const { basedir, cacheDir, supportCustomLengthUnitsPatch, tailwindcss, tailwindcssPatcherOptions } = options || {}
const cache: CacheOptions = {}

if (cacheDir) {
Expand All @@ -28,23 +28,23 @@ export function createTailwindcssPatcher(options?: CreateTailwindcssPatcherOptio
}
}

return new TailwindcssPatcher({
cache,
patch: defuOverrideArray<PatchOptions, PatchOptions[]>(patch!, {
basedir,
applyPatches: {
exportContext: true,
extendLengthUnits: supportCustomLengthUnitsPatch,
return new TailwindcssPatcher(defuOverrideArray<TailwindcssPatcherOptions, TailwindcssPatcherOptions[]>(
tailwindcssPatcherOptions!,
{
cache,
patch: {
basedir,
applyPatches: {
exportContext: true,
extendLengthUnits: supportCustomLengthUnitsPatch,
},
tailwindcss,
resolve: {
paths: [
import.meta.url,
],
},
},
tailwindcss,
resolve: {
paths: [
import.meta.url,
],
},
// filter: (x) => {
// return !isAllowedClassName(x)
// },
}),
})
},
))
}
4 changes: 2 additions & 2 deletions packages/weapp-tailwindcss/src/typedoc.export.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import type { ParserOptions } from '@babel/parser'
import type { IMangleOptions } from '@weapp-tailwindcss/mangle'
import type { CssPreflightOptions, CustomRuleCallback, LoadedPostcssOptions } from '@weapp-tailwindcss/postcss'
import type { pluginOptions as PresetEnvOptions } from 'postcss-preset-env'
import type { ILengthUnitsPatchOptions, PatchOptions } from 'tailwindcss-patch'
import type { ILengthUnitsPatchOptions, PatchOptions, TailwindcssPatcherOptions } from 'tailwindcss-patch'
import type { ICreateCacheReturnType } from './cache'
import type { AppType, IArbitraryValues, ICustomAttributes } from './types'

Expand Down Expand Up @@ -416,7 +416,7 @@ export interface UserDefinedOptions {
* @group 3.一般配置
* @description 自定义 patcher 参数
*/
patch?: PatchOptions
tailwindcssPatcherOptions?: TailwindcssPatcherOptions
}

// 4.即将废弃配置
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,12 +144,14 @@ exports[`get options > default options 1`] = `
"onLoad": [Function],
"onStart": [Function],
"onUpdate": [Function],
"patch": {
"filter": [Function],
},
"postcssOptions": {},
"setMangleRuntimeSet": [Function],
"styleHandler": [Function],
"tailwindcssPatcherOptions": {
"patch": {
"filter": [Function],
},
},
"templateHandler": [Function],
"wxsMatcher": [Function],
}
Expand Down
Loading

0 comments on commit 5618019

Please sign in to comment.