weapp-tailwindcss 2.9.2 → 2.10.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.
- package/README.md +13 -9
- package/dist/cache/index.d.ts +5 -2
- package/dist/cli.js +5 -4
- package/dist/cli.mjs +5 -4
- package/dist/constants--OCCPvZ8.mjs +36 -0
- package/dist/constants-9jsALkux.js +42 -0
- package/dist/css-macro/constants.d.ts +14 -0
- package/dist/css-macro/index.d.ts +15 -0
- package/dist/css-macro/index.js +36 -0
- package/dist/css-macro/index.mjs +30 -0
- package/dist/css-macro/postcss.d.ts +5 -0
- package/dist/css-macro/postcss.js +35 -0
- package/dist/css-macro/postcss.mjs +33 -0
- package/dist/defaults.js +1 -1
- package/dist/defaults.mjs +1 -1
- package/dist/defu-R3SAEzGq.mjs +43 -0
- package/dist/defu-d2wgbAKv.js +45 -0
- package/dist/gulp.js +19 -14
- package/dist/gulp.mjs +19 -14
- package/dist/index.js +8 -7
- package/dist/index.mjs +8 -7
- package/dist/{options-e1a9fdd3.mjs → options-1ejnE5kK.mjs} +53 -56
- package/dist/{options-9dd8de2e.js → options-jeQuZCU1.js} +57 -59
- package/dist/postcss/index.d.ts +2 -2
- package/dist/{postcss-8d7f67b4.js → postcss-03jfy6ZA.js} +1 -1
- package/dist/{postcss-55ed4d42.mjs → postcss-GEOOjC-4.mjs} +1 -1
- package/dist/postcss.js +2 -2
- package/dist/postcss.mjs +2 -2
- package/dist/replace.js +1 -1
- package/dist/replace.mjs +1 -1
- package/dist/types.d.ts +2 -1
- package/dist/vite.js +115 -110
- package/dist/vite.mjs +115 -110
- package/dist/webpack.js +20 -17
- package/dist/webpack.mjs +20 -17
- package/package.json +51 -37
- /package/dist/{defaults-b7341550.js → defaults-0O-zKoXE.js} +0 -0
- /package/dist/{defaults-d2c66d23.mjs → defaults-dz6xGhOP.mjs} +0 -0
- /package/dist/{index-84c7aa87.mjs → index-06BoOZig.mjs} +0 -0
- /package/dist/{index-aede98ce.js → index-z25r_Htj.js} +0 -0
- /package/dist/{shared-283aac78.mjs → shared-S0v7ZvWs.mjs} +0 -0
- /package/dist/{shared-8b9be5f0.js → shared-nXoJWFdz.js} +0 -0
package/README.md
CHANGED
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
> `小程序` + `tailwindcss` 全方面解决方案
|
|
25
25
|
> 想试试在小程序里使用 `CSS-in-JS` 思想? 👉🏻👉🏻试试 [`weapp-pandacss`](https://github.com/sonofmagic/weapp-pandacss)
|
|
26
26
|
|
|
27
|
-
\[[国内部署的文档地址](https://weapp-tw.icebreaker.top)\] \| \[[备用Github Page](https://sonofmagic.github.io/weapp-tailwindcss/)\] \| \[[1.x文档](./v1.md)\]
|
|
27
|
+
\[[国内部署的文档地址](https://weapp-tw.icebreaker.top)\] \| \[[备用Github Page](https://sonofmagic.github.io/weapp-tailwindcss/)\] \| \[[1.x文档]('./v1.md')\]
|
|
28
28
|
|
|
29
29
|
- [Tips](#tips)
|
|
30
30
|
- [特性](#特性)
|
|
@@ -43,13 +43,15 @@
|
|
|
43
43
|
- [使用`hbuilderx` 进行构建和开发](#使用hbuilderx-进行构建和开发)
|
|
44
44
|
- [使用`tarojs`进行构建 `vscode`开发](#使用tarojs进行构建-vscode开发)
|
|
45
45
|
- [原生小程序开发模板](#原生小程序开发模板)
|
|
46
|
-
- [tailwindcss plugin](#tailwindcss-plugin)
|
|
47
|
-
- [
|
|
46
|
+
- [tailwindcss plugin / util](#tailwindcss-plugin--util)
|
|
47
|
+
- [weapp-pandacss](#weapp-pandacss)
|
|
48
48
|
- [Bugs \& Issues](#bugs--issues)
|
|
49
49
|
|
|
50
50
|
## Tips
|
|
51
51
|
|
|
52
|
-
自从 `2.3.3` 版本开始,我发布了一个额外的包叫 `weapp-tailwindcss`,它和 `weapp-tailwindcss-webpack-plugin` 代码版本完全一致,且保持发布版本的同步。以后可以都去安装 `weapp-tailwindcss` 这个包(当然现在 `webpack-plugin` 这个包也不会废弃,也会时刻保持版本的同步)。为什么要这么做的原因,主要是因为 `weapp-tailwindcss-webpack-plugin`
|
|
52
|
+
自从 `2.3.3` 版本开始,我发布了一个额外的包叫 `weapp-tailwindcss`,它和 `weapp-tailwindcss-webpack-plugin` 代码版本完全一致,且保持发布版本的同步。以后可以都去安装 `weapp-tailwindcss` 这个包(当然现在 `webpack-plugin` 这个包也不会废弃,也会时刻保持版本的同步)。为什么要这么做的原因,主要是因为 `weapp-tailwindcss-webpack-plugin` 这个名字,已经不适合描述现在这种,多插件并存的状态了,为了以后的发展就改了个名字。
|
|
53
|
+
|
|
54
|
+
前沿阅读: [What’s Tailwind Oxide Engine? The Next Evolution of Tailwind CSS](https://medium.com/@bomber.marek/whats-tailwind-oxide-engine-the-next-evolution-of-tailwind-css-32e7ef8e19a1),未来 `tailwindcss` 会切换到这个引擎来大幅加快构建和运行速度,当然等它发布正式版本的时候,我也会尽可能第一时间去进行兼容新的引擎。
|
|
53
55
|
|
|
54
56
|
## 特性
|
|
55
57
|
|
|
@@ -63,7 +65,7 @@
|
|
|
63
65
|
|
|
64
66
|
### 插件介绍
|
|
65
67
|
|
|
66
|
-
从 `weapp-tailwindcss/webpack` 导出的`UnifiedWebpackPluginV5` 是一个核心插件,所有使用 `
|
|
68
|
+
从 `weapp-tailwindcss/webpack` 导出的`UnifiedWebpackPluginV5` 是一个核心插件,所有使用 `webpack5` 进行打包的框架都可以使用它。
|
|
67
69
|
|
|
68
70
|
从 `weapp-tailwindcss/vite` 导出的`UnifiedViteWeappTailwindcssPlugin` 为 `vite` 专用插件,配置项和使用方式和 `webpack` 插件是一致的。
|
|
69
71
|
|
|
@@ -121,13 +123,15 @@
|
|
|
121
123
|
|
|
122
124
|
[weapp-native-mina-tailwindcss-template(webpack打包)](https://github.com/sonofmagic/weapp-native-mina-tailwindcss-template)
|
|
123
125
|
|
|
124
|
-
### tailwindcss plugin
|
|
126
|
+
### tailwindcss plugin / util
|
|
127
|
+
|
|
128
|
+
- [css-to-tailwindcss-plugin](https://github.com/sonofmagic/icestack/tree/main/packages/css-to-tailwindcss-plugin) transform your `css/scss` to `tailwindcss plugin`
|
|
125
129
|
|
|
126
|
-
[weapp-tailwindcss-children](https://github.com/sonofmagic/weapp-tailwindcss-children)
|
|
130
|
+
- [weapp-tailwindcss-children](https://github.com/sonofmagic/weapp-tailwindcss-children)
|
|
127
131
|
|
|
128
|
-
###
|
|
132
|
+
### weapp-pandacss
|
|
129
133
|
|
|
130
|
-
[
|
|
134
|
+
[weapp-pandacss](https://github.com/sonofmagic/weapp-pandacss) `CSS-in-JS` 编译时框架的小程序适配器
|
|
131
135
|
|
|
132
136
|
## Bugs & Issues
|
|
133
137
|
|
package/dist/cache/index.d.ts
CHANGED
|
@@ -18,10 +18,13 @@ export interface ICreateCacheReturnType {
|
|
|
18
18
|
set: <V extends CacheValue = sources.Source>(key: string, value: V) => this['instance'];
|
|
19
19
|
has: (key: string) => boolean;
|
|
20
20
|
calcHashValueChanged: (key: HashMapKey, hash: string) => this;
|
|
21
|
-
process: (key: string, callback: () => void | false
|
|
21
|
+
process: (key: string, callback: () => void | false | Promise<void | false>, fallback: () => void | {
|
|
22
22
|
key: string;
|
|
23
23
|
source: CacheValue;
|
|
24
|
-
}
|
|
24
|
+
} | Promise<void | {
|
|
25
|
+
key: string;
|
|
26
|
+
source: CacheValue;
|
|
27
|
+
}>) => void | Promise<void>;
|
|
25
28
|
}
|
|
26
29
|
declare function createCache(): ICreateCacheReturnType;
|
|
27
30
|
export { createCache };
|
package/dist/cli.js
CHANGED
|
@@ -1,21 +1,22 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var options = require('./options-
|
|
3
|
+
var options = require('./options-jeQuZCU1.js');
|
|
4
4
|
require('micromatch');
|
|
5
5
|
require('magic-string');
|
|
6
6
|
require('./replace.js');
|
|
7
7
|
require('@weapp-core/escape');
|
|
8
8
|
require('@ast-core/escape');
|
|
9
|
-
require('./shared-
|
|
9
|
+
require('./shared-nXoJWFdz.js');
|
|
10
10
|
require('@weapp-core/regex');
|
|
11
11
|
require('@babel/generator');
|
|
12
12
|
require('@babel/parser');
|
|
13
13
|
require('@babel/traverse');
|
|
14
|
-
require('./
|
|
14
|
+
require('./defu-d2wgbAKv.js');
|
|
15
|
+
require('./defaults-0O-zKoXE.js');
|
|
15
16
|
require('@babel/types');
|
|
16
17
|
require('htmlparser2');
|
|
17
18
|
require('postcss');
|
|
18
|
-
require('./postcss-
|
|
19
|
+
require('./postcss-03jfy6ZA.js');
|
|
19
20
|
require('postcss-selector-parser');
|
|
20
21
|
require('@csstools/postcss-is-pseudo-class');
|
|
21
22
|
require('node:path');
|
package/dist/cli.mjs
CHANGED
|
@@ -1,19 +1,20 @@
|
|
|
1
|
-
import { g as getOptions, c as createPatch } from './options-
|
|
1
|
+
import { g as getOptions, c as createPatch } from './options-1ejnE5kK.mjs';
|
|
2
2
|
import 'micromatch';
|
|
3
3
|
import 'magic-string';
|
|
4
4
|
import './replace.mjs';
|
|
5
5
|
import '@weapp-core/escape';
|
|
6
6
|
import '@ast-core/escape';
|
|
7
|
-
import './shared-
|
|
7
|
+
import './shared-S0v7ZvWs.mjs';
|
|
8
8
|
import '@weapp-core/regex';
|
|
9
9
|
import '@babel/generator';
|
|
10
10
|
import '@babel/parser';
|
|
11
11
|
import '@babel/traverse';
|
|
12
|
-
import './
|
|
12
|
+
import './defu-R3SAEzGq.mjs';
|
|
13
|
+
import './defaults-dz6xGhOP.mjs';
|
|
13
14
|
import '@babel/types';
|
|
14
15
|
import 'htmlparser2';
|
|
15
16
|
import 'postcss';
|
|
16
|
-
import './postcss-
|
|
17
|
+
import './postcss-GEOOjC-4.mjs';
|
|
17
18
|
import 'postcss-selector-parser';
|
|
18
19
|
import '@csstools/postcss-is-pseudo-class';
|
|
19
20
|
import 'node:path';
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
const queryKey = 'weapp-tw-platform';
|
|
2
|
+
function createMediaQuery(value) {
|
|
3
|
+
return `@media (${queryKey}:${value}){&}`;
|
|
4
|
+
}
|
|
5
|
+
function createNegativeMediaQuery(value) {
|
|
6
|
+
return `@media not screen and (${queryKey}:${value}){&}`;
|
|
7
|
+
}
|
|
8
|
+
function normalComment(text) {
|
|
9
|
+
if (typeof text === 'string') {
|
|
10
|
+
return text.replaceAll(/(?<!\\)_/g, ' ');
|
|
11
|
+
}
|
|
12
|
+
return text;
|
|
13
|
+
}
|
|
14
|
+
function ifdef(text) {
|
|
15
|
+
return {
|
|
16
|
+
start: `#ifdef ${normalComment(text)} `,
|
|
17
|
+
end: `#endif`
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
function ifndef(text) {
|
|
21
|
+
return {
|
|
22
|
+
start: `#ifndef ${normalComment(text)} `,
|
|
23
|
+
end: `#endif`
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
function matchCustomPropertyFromValue(str, cb) {
|
|
27
|
+
let arr;
|
|
28
|
+
let index = 0;
|
|
29
|
+
const regex = new RegExp('\\(\\s*' + queryKey + '\\s*:([^)]*)\\)', 'g');
|
|
30
|
+
while ((arr = regex.exec(str)) !== null) {
|
|
31
|
+
cb(arr, index);
|
|
32
|
+
index++;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export { createNegativeMediaQuery as a, ifdef as b, createMediaQuery as c, ifndef as i, matchCustomPropertyFromValue as m };
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const queryKey = 'weapp-tw-platform';
|
|
4
|
+
function createMediaQuery(value) {
|
|
5
|
+
return `@media (${queryKey}:${value}){&}`;
|
|
6
|
+
}
|
|
7
|
+
function createNegativeMediaQuery(value) {
|
|
8
|
+
return `@media not screen and (${queryKey}:${value}){&}`;
|
|
9
|
+
}
|
|
10
|
+
function normalComment(text) {
|
|
11
|
+
if (typeof text === 'string') {
|
|
12
|
+
return text.replaceAll(/(?<!\\)_/g, ' ');
|
|
13
|
+
}
|
|
14
|
+
return text;
|
|
15
|
+
}
|
|
16
|
+
function ifdef(text) {
|
|
17
|
+
return {
|
|
18
|
+
start: `#ifdef ${normalComment(text)} `,
|
|
19
|
+
end: `#endif`
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
function ifndef(text) {
|
|
23
|
+
return {
|
|
24
|
+
start: `#ifndef ${normalComment(text)} `,
|
|
25
|
+
end: `#endif`
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
function matchCustomPropertyFromValue(str, cb) {
|
|
29
|
+
let arr;
|
|
30
|
+
let index = 0;
|
|
31
|
+
const regex = new RegExp('\\(\\s*' + queryKey + '\\s*:([^)]*)\\)', 'g');
|
|
32
|
+
while ((arr = regex.exec(str)) !== null) {
|
|
33
|
+
cb(arr, index);
|
|
34
|
+
index++;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
exports.createMediaQuery = createMediaQuery;
|
|
39
|
+
exports.createNegativeMediaQuery = createNegativeMediaQuery;
|
|
40
|
+
exports.ifdef = ifdef;
|
|
41
|
+
exports.ifndef = ifndef;
|
|
42
|
+
exports.matchCustomPropertyFromValue = matchCustomPropertyFromValue;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export declare const uniAppPlatform: string[];
|
|
2
|
+
export declare const queryKey = "weapp-tw-platform";
|
|
3
|
+
export declare function createMediaQuery(value: string): string;
|
|
4
|
+
export declare function createNegativeMediaQuery(value: string): string;
|
|
5
|
+
export declare function normalComment(text: string): string;
|
|
6
|
+
export declare function ifdef(text: string): {
|
|
7
|
+
start: string;
|
|
8
|
+
end: string;
|
|
9
|
+
};
|
|
10
|
+
export declare function ifndef(text: string): {
|
|
11
|
+
start: string;
|
|
12
|
+
end: string;
|
|
13
|
+
};
|
|
14
|
+
export declare function matchCustomPropertyFromValue(str: string, cb: (arr: RegExpExecArray, index: number) => void): void;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export interface Options {
|
|
2
|
+
variantsMap?: Record<string, string | {
|
|
3
|
+
value: string;
|
|
4
|
+
negative?: boolean;
|
|
5
|
+
}>;
|
|
6
|
+
dynamic?: boolean;
|
|
7
|
+
}
|
|
8
|
+
declare const _default: {
|
|
9
|
+
(options: Options): {
|
|
10
|
+
handler: import("tailwindcss/types/config").PluginCreator;
|
|
11
|
+
config?: Partial<import("tailwindcss").Config> | undefined;
|
|
12
|
+
};
|
|
13
|
+
__isOptionsFunction: true;
|
|
14
|
+
};
|
|
15
|
+
export default _default;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var plugin = require('tailwindcss/plugin');
|
|
4
|
+
var constants = require('../constants-9jsALkux.js');
|
|
5
|
+
var defu = require('../defu-d2wgbAKv.js');
|
|
6
|
+
|
|
7
|
+
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
8
|
+
|
|
9
|
+
var plugin__default = /*#__PURE__*/_interopDefaultCompat(plugin);
|
|
10
|
+
|
|
11
|
+
var index = plugin__default["default"].withOptions((options) => {
|
|
12
|
+
const { dynamic: dynamicMode, variantsMap } = defu.defu(options, {
|
|
13
|
+
dynamic: true,
|
|
14
|
+
variantsMap: {}
|
|
15
|
+
});
|
|
16
|
+
return ({ matchVariant, addVariant }) => {
|
|
17
|
+
if (dynamicMode) {
|
|
18
|
+
matchVariant('ifdef', (value) => {
|
|
19
|
+
return constants.createMediaQuery(value);
|
|
20
|
+
});
|
|
21
|
+
matchVariant('ifndef', (value) => {
|
|
22
|
+
return constants.createNegativeMediaQuery(value);
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
for (const [name, obj] of Object.entries(variantsMap)) {
|
|
26
|
+
if (typeof obj === 'string') {
|
|
27
|
+
addVariant(name, constants.createMediaQuery(obj));
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
addVariant(name, obj.negative ? constants.createNegativeMediaQuery(obj.value) : constants.createMediaQuery(obj.value));
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
module.exports = index;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import plugin from 'tailwindcss/plugin';
|
|
2
|
+
import { c as createMediaQuery, a as createNegativeMediaQuery } from '../constants--OCCPvZ8.mjs';
|
|
3
|
+
import { d as defu } from '../defu-R3SAEzGq.mjs';
|
|
4
|
+
|
|
5
|
+
var index = plugin.withOptions((options) => {
|
|
6
|
+
const { dynamic: dynamicMode, variantsMap } = defu(options, {
|
|
7
|
+
dynamic: true,
|
|
8
|
+
variantsMap: {}
|
|
9
|
+
});
|
|
10
|
+
return ({ matchVariant, addVariant }) => {
|
|
11
|
+
if (dynamicMode) {
|
|
12
|
+
matchVariant('ifdef', (value) => {
|
|
13
|
+
return createMediaQuery(value);
|
|
14
|
+
});
|
|
15
|
+
matchVariant('ifndef', (value) => {
|
|
16
|
+
return createNegativeMediaQuery(value);
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
for (const [name, obj] of Object.entries(variantsMap)) {
|
|
20
|
+
if (typeof obj === 'string') {
|
|
21
|
+
addVariant(name, createMediaQuery(obj));
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
addVariant(name, obj.negative ? createNegativeMediaQuery(obj.value) : createMediaQuery(obj.value));
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
export { index as default };
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var constants = require('../constants-9jsALkux.js');
|
|
4
|
+
|
|
5
|
+
const creator = () => {
|
|
6
|
+
return {
|
|
7
|
+
postcssPlugin: 'postcss-weapp-tw-css-macro-plugin',
|
|
8
|
+
AtRuleExit(atRule, helper) {
|
|
9
|
+
if (atRule.name === 'media') {
|
|
10
|
+
const values = [];
|
|
11
|
+
constants.matchCustomPropertyFromValue(atRule.params, (arr) => {
|
|
12
|
+
values.push(arr[1]);
|
|
13
|
+
});
|
|
14
|
+
if (values.length > 0) {
|
|
15
|
+
const isNegative = atRule.params.includes('not');
|
|
16
|
+
const text = values.join(' ');
|
|
17
|
+
const comment = isNegative ? constants.ifndef(text) : constants.ifdef(text);
|
|
18
|
+
atRule.after([
|
|
19
|
+
helper.comment({
|
|
20
|
+
text: comment.start
|
|
21
|
+
}),
|
|
22
|
+
...atRule.nodes,
|
|
23
|
+
helper.comment({
|
|
24
|
+
text: comment.end
|
|
25
|
+
})
|
|
26
|
+
]);
|
|
27
|
+
atRule.remove();
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
creator.postcss = true;
|
|
34
|
+
|
|
35
|
+
module.exports = creator;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { m as matchCustomPropertyFromValue, i as ifndef, b as ifdef } from '../constants--OCCPvZ8.mjs';
|
|
2
|
+
|
|
3
|
+
const creator = () => {
|
|
4
|
+
return {
|
|
5
|
+
postcssPlugin: 'postcss-weapp-tw-css-macro-plugin',
|
|
6
|
+
AtRuleExit(atRule, helper) {
|
|
7
|
+
if (atRule.name === 'media') {
|
|
8
|
+
const values = [];
|
|
9
|
+
matchCustomPropertyFromValue(atRule.params, (arr) => {
|
|
10
|
+
values.push(arr[1]);
|
|
11
|
+
});
|
|
12
|
+
if (values.length > 0) {
|
|
13
|
+
const isNegative = atRule.params.includes('not');
|
|
14
|
+
const text = values.join(' ');
|
|
15
|
+
const comment = isNegative ? ifndef(text) : ifdef(text);
|
|
16
|
+
atRule.after([
|
|
17
|
+
helper.comment({
|
|
18
|
+
text: comment.start
|
|
19
|
+
}),
|
|
20
|
+
...atRule.nodes,
|
|
21
|
+
helper.comment({
|
|
22
|
+
text: comment.end
|
|
23
|
+
})
|
|
24
|
+
]);
|
|
25
|
+
atRule.remove();
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
creator.postcss = true;
|
|
32
|
+
|
|
33
|
+
export { creator as default };
|
package/dist/defaults.js
CHANGED
package/dist/defaults.mjs
CHANGED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
function isObject(value) {
|
|
2
|
+
return value !== null && typeof value === "object";
|
|
3
|
+
}
|
|
4
|
+
function _defu(baseObject, defaults, namespace = ".", merger) {
|
|
5
|
+
if (!isObject(defaults)) {
|
|
6
|
+
return _defu(baseObject, {}, namespace, merger);
|
|
7
|
+
}
|
|
8
|
+
const object = Object.assign({}, defaults);
|
|
9
|
+
for (const key in baseObject) {
|
|
10
|
+
if (key === "__proto__" || key === "constructor") {
|
|
11
|
+
continue;
|
|
12
|
+
}
|
|
13
|
+
const value = baseObject[key];
|
|
14
|
+
if (value === null || value === void 0) {
|
|
15
|
+
continue;
|
|
16
|
+
}
|
|
17
|
+
if (merger && merger(object, key, value, namespace)) {
|
|
18
|
+
continue;
|
|
19
|
+
}
|
|
20
|
+
if (Array.isArray(value) && Array.isArray(object[key])) {
|
|
21
|
+
object[key] = [...value, ...object[key]];
|
|
22
|
+
} else if (isObject(value) && isObject(object[key])) {
|
|
23
|
+
object[key] = _defu(
|
|
24
|
+
value,
|
|
25
|
+
object[key],
|
|
26
|
+
(namespace ? `${namespace}.` : "") + key.toString(),
|
|
27
|
+
merger
|
|
28
|
+
);
|
|
29
|
+
} else {
|
|
30
|
+
object[key] = value;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
return object;
|
|
34
|
+
}
|
|
35
|
+
function createDefu(merger) {
|
|
36
|
+
return (...arguments_) => (
|
|
37
|
+
// eslint-disable-next-line unicorn/no-array-reduce
|
|
38
|
+
arguments_.reduce((p, c) => _defu(p, c, "", merger), {})
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
const defu = createDefu();
|
|
42
|
+
|
|
43
|
+
export { defu as d };
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
function isObject(value) {
|
|
4
|
+
return value !== null && typeof value === "object";
|
|
5
|
+
}
|
|
6
|
+
function _defu(baseObject, defaults, namespace = ".", merger) {
|
|
7
|
+
if (!isObject(defaults)) {
|
|
8
|
+
return _defu(baseObject, {}, namespace, merger);
|
|
9
|
+
}
|
|
10
|
+
const object = Object.assign({}, defaults);
|
|
11
|
+
for (const key in baseObject) {
|
|
12
|
+
if (key === "__proto__" || key === "constructor") {
|
|
13
|
+
continue;
|
|
14
|
+
}
|
|
15
|
+
const value = baseObject[key];
|
|
16
|
+
if (value === null || value === void 0) {
|
|
17
|
+
continue;
|
|
18
|
+
}
|
|
19
|
+
if (merger && merger(object, key, value, namespace)) {
|
|
20
|
+
continue;
|
|
21
|
+
}
|
|
22
|
+
if (Array.isArray(value) && Array.isArray(object[key])) {
|
|
23
|
+
object[key] = [...value, ...object[key]];
|
|
24
|
+
} else if (isObject(value) && isObject(object[key])) {
|
|
25
|
+
object[key] = _defu(
|
|
26
|
+
value,
|
|
27
|
+
object[key],
|
|
28
|
+
(namespace ? `${namespace}.` : "") + key.toString(),
|
|
29
|
+
merger
|
|
30
|
+
);
|
|
31
|
+
} else {
|
|
32
|
+
object[key] = value;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
return object;
|
|
36
|
+
}
|
|
37
|
+
function createDefu(merger) {
|
|
38
|
+
return (...arguments_) => (
|
|
39
|
+
// eslint-disable-next-line unicorn/no-array-reduce
|
|
40
|
+
arguments_.reduce((p, c) => _defu(p, c, "", merger), {})
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
const defu = createDefu();
|
|
44
|
+
|
|
45
|
+
exports.defu = defu;
|
package/dist/gulp.js
CHANGED
|
@@ -2,23 +2,24 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
+
var options = require('./options-jeQuZCU1.js');
|
|
5
6
|
var stream = require('node:stream');
|
|
6
|
-
var options = require('./options-9dd8de2e.js');
|
|
7
7
|
require('micromatch');
|
|
8
8
|
require('magic-string');
|
|
9
9
|
require('./replace.js');
|
|
10
10
|
require('@weapp-core/escape');
|
|
11
11
|
require('@ast-core/escape');
|
|
12
|
-
require('./shared-
|
|
12
|
+
require('./shared-nXoJWFdz.js');
|
|
13
13
|
require('@weapp-core/regex');
|
|
14
14
|
require('@babel/generator');
|
|
15
15
|
require('@babel/parser');
|
|
16
16
|
require('@babel/traverse');
|
|
17
|
-
require('./
|
|
17
|
+
require('./defu-d2wgbAKv.js');
|
|
18
|
+
require('./defaults-0O-zKoXE.js');
|
|
18
19
|
require('@babel/types');
|
|
19
20
|
require('htmlparser2');
|
|
20
21
|
require('postcss');
|
|
21
|
-
require('./postcss-
|
|
22
|
+
require('./postcss-03jfy6ZA.js');
|
|
22
23
|
require('postcss-selector-parser');
|
|
23
24
|
require('@csstools/postcss-is-pseudo-class');
|
|
24
25
|
require('node:path');
|
|
@@ -39,23 +40,27 @@ function createPlugins(options$1 = {}) {
|
|
|
39
40
|
options$1.customReplaceDictionary = 'simple';
|
|
40
41
|
}
|
|
41
42
|
const opts = options.getOptions(options$1);
|
|
42
|
-
const { templateHandler, styleHandler, patch, jsHandler, setMangleRuntimeSet } = opts;
|
|
43
|
+
const { templateHandler, styleHandler, patch, jsHandler, setMangleRuntimeSet, tailwindcssBasedir } = opts;
|
|
43
44
|
let runtimeSet = new Set();
|
|
44
45
|
patch === null || patch === void 0 ? void 0 : patch();
|
|
45
46
|
const twPatcher = options.createTailwindcssPatcher();
|
|
46
47
|
function transformWxss() {
|
|
47
48
|
const transformStream = new Transform({ objectMode: true });
|
|
48
49
|
transformStream._transform = function (file, encoding, callback) {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
if (file.contents) {
|
|
53
|
-
const code = styleHandler(file.contents.toString(), {
|
|
54
|
-
isMainChunk: true
|
|
50
|
+
return options.__awaiter(this, void 0, void 0, function* () {
|
|
51
|
+
runtimeSet = twPatcher.getClassSet({
|
|
52
|
+
basedir: tailwindcssBasedir
|
|
55
53
|
});
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
54
|
+
setMangleRuntimeSet(runtimeSet);
|
|
55
|
+
const error = null;
|
|
56
|
+
if (file.contents) {
|
|
57
|
+
const code = yield styleHandler(file.contents.toString(), {
|
|
58
|
+
isMainChunk: true
|
|
59
|
+
});
|
|
60
|
+
file.contents = Buffer.from(code);
|
|
61
|
+
}
|
|
62
|
+
callback(error, file);
|
|
63
|
+
});
|
|
59
64
|
};
|
|
60
65
|
return transformStream;
|
|
61
66
|
}
|
package/dist/gulp.mjs
CHANGED
|
@@ -1,20 +1,21 @@
|
|
|
1
|
+
import { g as getOptions, a as createTailwindcssPatcher, _ as __awaiter } from './options-1ejnE5kK.mjs';
|
|
1
2
|
import stream from 'node:stream';
|
|
2
|
-
import { g as getOptions, a as createTailwindcssPatcher } from './options-e1a9fdd3.mjs';
|
|
3
3
|
import 'micromatch';
|
|
4
4
|
import 'magic-string';
|
|
5
5
|
import './replace.mjs';
|
|
6
6
|
import '@weapp-core/escape';
|
|
7
7
|
import '@ast-core/escape';
|
|
8
|
-
import './shared-
|
|
8
|
+
import './shared-S0v7ZvWs.mjs';
|
|
9
9
|
import '@weapp-core/regex';
|
|
10
10
|
import '@babel/generator';
|
|
11
11
|
import '@babel/parser';
|
|
12
12
|
import '@babel/traverse';
|
|
13
|
-
import './
|
|
13
|
+
import './defu-R3SAEzGq.mjs';
|
|
14
|
+
import './defaults-dz6xGhOP.mjs';
|
|
14
15
|
import '@babel/types';
|
|
15
16
|
import 'htmlparser2';
|
|
16
17
|
import 'postcss';
|
|
17
|
-
import './postcss-
|
|
18
|
+
import './postcss-GEOOjC-4.mjs';
|
|
18
19
|
import 'postcss-selector-parser';
|
|
19
20
|
import '@csstools/postcss-is-pseudo-class';
|
|
20
21
|
import 'node:path';
|
|
@@ -31,23 +32,27 @@ function createPlugins(options = {}) {
|
|
|
31
32
|
options.customReplaceDictionary = 'simple';
|
|
32
33
|
}
|
|
33
34
|
const opts = getOptions(options);
|
|
34
|
-
const { templateHandler, styleHandler, patch, jsHandler, setMangleRuntimeSet } = opts;
|
|
35
|
+
const { templateHandler, styleHandler, patch, jsHandler, setMangleRuntimeSet, tailwindcssBasedir } = opts;
|
|
35
36
|
let runtimeSet = new Set();
|
|
36
37
|
patch === null || patch === void 0 ? void 0 : patch();
|
|
37
38
|
const twPatcher = createTailwindcssPatcher();
|
|
38
39
|
function transformWxss() {
|
|
39
40
|
const transformStream = new Transform({ objectMode: true });
|
|
40
41
|
transformStream._transform = function (file, encoding, callback) {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
if (file.contents) {
|
|
45
|
-
const code = styleHandler(file.contents.toString(), {
|
|
46
|
-
isMainChunk: true
|
|
42
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
43
|
+
runtimeSet = twPatcher.getClassSet({
|
|
44
|
+
basedir: tailwindcssBasedir
|
|
47
45
|
});
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
46
|
+
setMangleRuntimeSet(runtimeSet);
|
|
47
|
+
const error = null;
|
|
48
|
+
if (file.contents) {
|
|
49
|
+
const code = yield styleHandler(file.contents.toString(), {
|
|
50
|
+
isMainChunk: true
|
|
51
|
+
});
|
|
52
|
+
file.contents = Buffer.from(code);
|
|
53
|
+
}
|
|
54
|
+
callback(error, file);
|
|
55
|
+
});
|
|
51
56
|
};
|
|
52
57
|
return transformStream;
|
|
53
58
|
}
|
package/dist/index.js
CHANGED
|
@@ -5,32 +5,33 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
var webpack = require('./webpack.js');
|
|
6
6
|
var vite = require('./vite.js');
|
|
7
7
|
var gulp = require('./gulp.js');
|
|
8
|
-
require('
|
|
9
|
-
require('node:fs');
|
|
10
|
-
require('./options-9dd8de2e.js');
|
|
8
|
+
require('./options-jeQuZCU1.js');
|
|
11
9
|
require('micromatch');
|
|
12
10
|
require('magic-string');
|
|
13
11
|
require('./replace.js');
|
|
14
12
|
require('@weapp-core/escape');
|
|
15
13
|
require('@ast-core/escape');
|
|
16
|
-
require('./shared-
|
|
14
|
+
require('./shared-nXoJWFdz.js');
|
|
17
15
|
require('@weapp-core/regex');
|
|
18
16
|
require('@babel/generator');
|
|
19
17
|
require('@babel/parser');
|
|
20
18
|
require('@babel/traverse');
|
|
21
|
-
require('./
|
|
19
|
+
require('./defu-d2wgbAKv.js');
|
|
20
|
+
require('./defaults-0O-zKoXE.js');
|
|
22
21
|
require('@babel/types');
|
|
23
22
|
require('htmlparser2');
|
|
24
23
|
require('postcss');
|
|
25
|
-
require('./postcss-
|
|
24
|
+
require('./postcss-03jfy6ZA.js');
|
|
26
25
|
require('postcss-selector-parser');
|
|
27
26
|
require('@csstools/postcss-is-pseudo-class');
|
|
27
|
+
require('node:path');
|
|
28
|
+
require('node:fs');
|
|
28
29
|
require('semver');
|
|
29
30
|
require('tailwindcss-patch');
|
|
30
31
|
require('@tailwindcss-mangle/shared');
|
|
31
32
|
require('lru-cache');
|
|
32
33
|
require('md5');
|
|
33
|
-
require('./index-
|
|
34
|
+
require('./index-z25r_Htj.js');
|
|
34
35
|
require('debug');
|
|
35
36
|
require('node:stream');
|
|
36
37
|
|