generated from sonofmagic/npm-lib-template
-
-
Notifications
You must be signed in to change notification settings - Fork 92
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: add @weapp-tailwindcss/postcss pkg
- Loading branch information
1 parent
05fb1e5
commit b1664a7
Showing
36 changed files
with
2,779 additions
and
213 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
{ | ||
"name": "@weapp-tailwindcss/postcss", | ||
"version": "0.0.0", | ||
"description": "@weapp-tailwindcss/postcss", | ||
"author": "ice breaker <[email protected]>", | ||
"license": "MIT", | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/sonofmagic/monorepo-template.git", | ||
"directory": "packages/bar" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/sonofmagic/monorepo-template/issues" | ||
}, | ||
"keywords": [], | ||
"sideEffects": false, | ||
"exports": { | ||
".": "./src/index.ts" | ||
}, | ||
"files": [ | ||
"dist" | ||
], | ||
"scripts": { | ||
"dev": "tsup --watch --sourcemap", | ||
"build": "tsup", | ||
"test": "vitest run", | ||
"test:dev": "vitest", | ||
"release": "pnpm publish", | ||
"lint": "eslint .", | ||
"lint:fix": "eslint . --fix" | ||
}, | ||
"publishConfig": { | ||
"exports": { | ||
".": { | ||
"types": "./dist/index.d.ts", | ||
"import": "./dist/index.mjs", | ||
"require": "./dist/index.js" | ||
}, | ||
"./types": { | ||
"types": "./dist/types.d.ts", | ||
"import": "./dist/types.mjs", | ||
"require": "./dist/types.js" | ||
} | ||
}, | ||
"main": "./dist/index.js", | ||
"module": "./dist/index.mjs", | ||
"types": "./dist/index.d.ts" | ||
}, | ||
"dependencies": { | ||
"@weapp-core/escape": "~3.0.2", | ||
"@weapp-tailwindcss/shared": "workspace:*", | ||
"postcss": "~8.4.49", | ||
"postcss-rem-to-responsive-pixel": "~6.0.2", | ||
"postcss-selector-parser": "~7.0.0" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export const postcssPlugin = 'postcss-weapp-tailwindcss-rename-plugin' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,206 @@ | ||
export default [ | ||
{ | ||
prop: '--tw-border-spacing-x', | ||
value: '0', | ||
}, | ||
{ | ||
prop: '--tw-border-spacing-y', | ||
value: '0', | ||
}, | ||
{ | ||
prop: '--tw-translate-x', | ||
value: '0', | ||
}, | ||
{ | ||
prop: '--tw-translate-y', | ||
value: '0', | ||
}, | ||
{ | ||
prop: '--tw-rotate', | ||
value: '0', | ||
}, | ||
{ | ||
prop: '--tw-skew-x', | ||
value: '0', | ||
}, | ||
{ | ||
prop: '--tw-skew-y', | ||
value: '0', | ||
}, | ||
{ | ||
prop: '--tw-scale-x', | ||
value: '1', | ||
}, | ||
{ | ||
prop: '--tw-scale-y', | ||
value: '1', | ||
}, | ||
{ | ||
prop: '--tw-pan-x', | ||
value: ' ', | ||
}, | ||
{ | ||
prop: '--tw-pan-y', | ||
value: ' ', | ||
}, | ||
{ | ||
prop: '--tw-pinch-zoom', | ||
value: ' ', | ||
}, | ||
{ | ||
prop: '--tw-scroll-snap-strictness', | ||
value: 'proximity', | ||
}, | ||
{ | ||
prop: '--tw-gradient-from-position', | ||
value: ' ', | ||
}, | ||
{ | ||
prop: '--tw-gradient-via-position', | ||
value: ' ', | ||
}, | ||
{ | ||
prop: '--tw-gradient-to-position', | ||
value: ' ', | ||
}, | ||
{ | ||
prop: '--tw-ordinal', | ||
value: ' ', | ||
}, | ||
{ | ||
prop: '--tw-slashed-zero', | ||
value: ' ', | ||
}, | ||
{ | ||
prop: '--tw-numeric-figure', | ||
value: ' ', | ||
}, | ||
{ | ||
prop: '--tw-numeric-spacing', | ||
value: ' ', | ||
}, | ||
{ | ||
prop: '--tw-numeric-fraction', | ||
value: ' ', | ||
}, | ||
{ | ||
prop: '--tw-ring-inset', | ||
value: ' ', | ||
}, | ||
{ | ||
prop: '--tw-ring-offset-width', | ||
value: '0px', | ||
}, | ||
{ | ||
prop: '--tw-ring-offset-color', | ||
value: '#fff', | ||
}, | ||
{ | ||
prop: '--tw-ring-color', | ||
value: 'rgb(59 130 246 / 0.5)', | ||
}, | ||
{ | ||
prop: '--tw-ring-offset-shadow', | ||
value: '0 0 #0000', | ||
}, | ||
{ | ||
prop: '--tw-ring-shadow', | ||
value: '0 0 #0000', | ||
}, | ||
{ | ||
prop: '--tw-shadow', | ||
value: '0 0 #0000', | ||
}, | ||
{ | ||
prop: '--tw-shadow-colored', | ||
value: '0 0 #0000', | ||
}, | ||
{ | ||
prop: '--tw-blur', | ||
value: ' ', | ||
}, | ||
{ | ||
prop: '--tw-brightness', | ||
value: ' ', | ||
}, | ||
{ | ||
prop: '--tw-contrast', | ||
value: ' ', | ||
}, | ||
{ | ||
prop: '--tw-grayscale', | ||
value: ' ', | ||
}, | ||
{ | ||
prop: '--tw-hue-rotate', | ||
value: ' ', | ||
}, | ||
{ | ||
prop: '--tw-invert', | ||
value: ' ', | ||
}, | ||
{ | ||
prop: '--tw-saturate', | ||
value: ' ', | ||
}, | ||
{ | ||
prop: '--tw-sepia', | ||
value: ' ', | ||
}, | ||
{ | ||
prop: '--tw-drop-shadow', | ||
value: ' ', | ||
}, | ||
{ | ||
prop: '--tw-backdrop-blur', | ||
value: ' ', | ||
}, | ||
{ | ||
prop: '--tw-backdrop-brightness', | ||
value: ' ', | ||
}, | ||
{ | ||
prop: '--tw-backdrop-contrast', | ||
value: ' ', | ||
}, | ||
{ | ||
prop: '--tw-backdrop-grayscale', | ||
value: ' ', | ||
}, | ||
{ | ||
prop: '--tw-backdrop-hue-rotate', | ||
value: ' ', | ||
}, | ||
{ | ||
prop: '--tw-backdrop-invert', | ||
value: ' ', | ||
}, | ||
{ | ||
prop: '--tw-backdrop-opacity', | ||
value: ' ', | ||
}, | ||
{ | ||
prop: '--tw-backdrop-saturate', | ||
value: ' ', | ||
}, | ||
{ | ||
prop: '--tw-backdrop-sepia', | ||
value: ' ', | ||
}, | ||
{ | ||
prop: '--tw-contain-size', | ||
value: ' ', | ||
}, | ||
{ | ||
prop: '--tw-contain-layout', | ||
value: ' ', | ||
}, | ||
{ | ||
prop: '--tw-contain-paint', | ||
value: ' ', | ||
}, | ||
{ | ||
prop: '--tw-contain-style', | ||
value: ' ', | ||
}, | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import type { IStyleHandlerOptions } from './types' | ||
import { defuOverrideArray } from '@weapp-tailwindcss/shared' | ||
import postcss from 'postcss' | ||
import { getPlugins } from './plugins' | ||
|
||
export function styleHandler(rawSource: string, options: IStyleHandlerOptions) { | ||
return postcss(getPlugins(options)) | ||
.process( | ||
rawSource, | ||
options.postcssOptions?.options ?? { | ||
from: undefined, | ||
}, | ||
) | ||
.async() | ||
} | ||
|
||
export function createStyleHandler(options: Partial<IStyleHandlerOptions>) { | ||
return (rawSource: string, opt?: Partial<IStyleHandlerOptions>) => { | ||
return styleHandler( | ||
rawSource, | ||
defuOverrideArray<IStyleHandlerOptions, Partial<IStyleHandlerOptions>[]>(opt as IStyleHandlerOptions, options), | ||
) | ||
} | ||
} |
Oops, something went wrong.