Skip to content

Commit 4256e92

Browse files
committed
chore: format tailwindcss patch codes
1 parent c202f6c commit 4256e92

File tree

8 files changed

+402
-72
lines changed

8 files changed

+402
-72
lines changed

packages/tailwindcss-patch/package.json

+26-25
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,31 @@
22
"name": "tailwindcss-patch",
33
"version": "2.2.4",
44
"description": "patch tailwindcss for exposing context and extract classes",
5+
"author": "SonOfMagic <qq1324318532@gmail.com>",
6+
"license": "MIT",
7+
"homepage": "https://github.com/sonofmagic/tailwindcss-mangle",
8+
"repository": {
9+
"type": "git",
10+
"url": "git+https://github.com/sonofmagic/tailwindcss-mangle.git"
11+
},
12+
"bugs": {
13+
"url": "https://github.com/sonofmagic/tailwindcss-mangle/issues"
14+
},
15+
"keywords": [
16+
"tailwindcss",
17+
"patch",
18+
"extract",
19+
"class"
20+
],
521
"main": "./dist/index.cjs",
622
"types": "./dist/index.d.ts",
723
"bin": {
824
"tw-patch": "bin/tw-patch.js",
925
"tailwindcss-patch": "bin/tw-patch.js"
1026
},
1127
"files": [
12-
"dist",
13-
"bin"
28+
"bin",
29+
"dist"
1430
],
1531
"scripts": {
1632
"dev": "unbuild --sourcemap",
@@ -19,14 +35,6 @@
1935
"test:dev": "vitest",
2036
"patch": "node bin/tw-patch.js install"
2137
},
22-
"keywords": [
23-
"tailwindcss",
24-
"patch",
25-
"extract",
26-
"class"
27-
],
28-
"author": "SonOfMagic <qq1324318532@gmail.com>",
29-
"license": "MIT",
3038
"publishConfig": {
3139
"access": "public",
3240
"registry": "https://registry.npmjs.org/"
@@ -39,14 +47,6 @@
3947
"optional": true
4048
}
4149
},
42-
"devDependencies": {
43-
"@types/babel__generator": "^7.6.8",
44-
"@types/babel__traverse": "^7.20.6",
45-
"@types/resolve": "^1.20.6",
46-
"@types/semver": "^7.5.8",
47-
"pkg-types": "^1.1.1",
48-
"tailwindcss": "^3.4.3"
49-
},
5050
"dependencies": {
5151
"@babel/generator": "^7.24.6",
5252
"@babel/parser": "^7.24.6",
@@ -60,13 +60,14 @@
6060
"resolve": "^1.22.8",
6161
"semver": "^7.6.2"
6262
},
63-
"homepage": "https://github.com/sonofmagic/tailwindcss-mangle",
64-
"repository": {
65-
"type": "git",
66-
"url": "git+https://github.com/sonofmagic/tailwindcss-mangle.git"
67-
},
68-
"bugs": {
69-
"url": "https://github.com/sonofmagic/tailwindcss-mangle/issues"
63+
"devDependencies": {
64+
"@types/babel__generator": "^7.6.8",
65+
"@types/babel__traverse": "^7.20.6",
66+
"@types/resolve": "^1.20.6",
67+
"@types/semver": "^7.5.8",
68+
"pkg-types": "^1.1.1",
69+
"tailwindcss": "^3.4.3",
70+
"tailwindcss2": "npm:@tailwindcss/postcss7-compat@^2.2.17"
7071
},
7172
"directories": {
7273
"test": "test"

packages/tailwindcss-patch/src/cli.ts

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import process from 'node:process'
12
import cac from 'cac'
23
import { configName, getConfig, initConfig } from './config'
34
import { TailwindcssPatcher, createPatch, getPatchOptions } from './core'

packages/tailwindcss-patch/src/core/cache.ts

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import fs from 'node:fs'
22
import path from 'node:path'
3+
import process from 'node:process'
34
import { pkgName } from '@/constants'
45
import type { CacheOptions, InternalCacheOptions } from '@/types'
56
import { log } from '@/logger'

packages/tailwindcss-patch/src/core/exposeContext.ts

+1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ export function getContexts(basedir?: string): TailwindcssRuntimeContext[] {
1919
injectFilePath = path.join(distPath, 'index.js')
2020
}
2121

22+
// eslint-disable-next-line ts/no-require-imports, ts/no-var-requires
2223
const mo = require(injectFilePath)
2324
if (mo.contextRef) {
2425
return mo.contextRef.value

packages/tailwindcss-patch/src/core/postcss.ts

+2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import path from 'node:path'
2+
import process from 'node:process'
23
import postcss from 'postcss'
34
import { lilconfig } from 'lilconfig'
45
import createJiti from 'jiti'
@@ -41,6 +42,7 @@ export async function processTailwindcss(options: { cwd?: string, config?: strin
4142
}
4243

4344
return await postcss([
45+
// eslint-disable-next-line ts/no-var-requires, ts/no-require-imports
4446
require('tailwindcss')({
4547
config,
4648
}),

packages/tailwindcss-patch/src/core/tw-patcher.ts

-3
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,6 @@ export class TailwindcssPatcher {
4040

4141
/**
4242
* @description 在多个 tailwindcss 上下文时,这个方法将被执行多次,所以策略上应该使用 append
43-
* 详见 taro weapp-tailwindcss 独立分包
44-
* @param basedir
45-
* @returns
4643
*/
4744
getClassSet(options?: { basedir?: string, cacheStrategy?: CacheStrategy, removeUniversalSelector?: boolean }) {
4845
const { basedir, cacheStrategy = this.cacheOptions.strategy ?? 'merge', removeUniversalSelector = true } = options ?? {}

packages/tailwindcss-patch/src/types.ts

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
/* eslint-disable @typescript-eslint/ban-types */
21
import type { Node, Rule } from 'postcss'
32
import type { Config } from 'tailwindcss'
43

0 commit comments

Comments
 (0)