weapp-tailwindcss 5.0.0-next.13 → 5.0.0-next.15
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/dist/{bundle-state-Bz8vLnCf.js → bundle-state-ClSg28Qk.js} +1 -1
- package/dist/{bundle-state-CP2XS3Uj.mjs → bundle-state-CrhkNTsw.mjs} +1 -1
- package/dist/bundlers/shared/generator-css/markers.d.ts +8 -0
- package/dist/bundlers/shared/generator-css.d.ts +1 -1
- package/dist/cli.js +33 -9
- package/dist/cli.mjs +33 -9
- package/dist/core.js +1 -1
- package/dist/core.mjs +1 -1
- package/dist/css-macro/postcss.js +1 -1
- package/dist/css-macro/postcss.mjs +1 -1
- package/dist/css-macro.js +2 -2
- package/dist/css-macro.mjs +2 -2
- package/dist/defaults-B1igPF_e.mjs +150 -0
- package/dist/defaults-IHhYxNeU.js +193 -0
- package/dist/defaults.js +6 -150
- package/dist/defaults.mjs +1 -143
- package/dist/{generator-CRORPkpW.js → generator-CImaTibB.js} +1 -1
- package/dist/{generator-C9H44wEF.mjs → generator-DSMdL4vg.mjs} +1 -1
- package/dist/generator.js +2 -2
- package/dist/generator.mjs +2 -2
- package/dist/gulp.js +5 -5
- package/dist/gulp.mjs +5 -5
- package/dist/{incremental-runtime-class-set-DN9KKjSi.js → incremental-runtime-class-set-CH1L--wj.js} +74 -31
- package/dist/{incremental-runtime-class-set-Dbn4yPfZ.mjs → incremental-runtime-class-set-P-3ZoWW5.mjs} +74 -31
- package/dist/index.js +4 -4
- package/dist/index.mjs +4 -4
- package/dist/js/babel/cache-options.d.ts +3 -0
- package/dist/js/babel/parse.d.ts +7 -4
- package/dist/{postcss-CtlrNknb.mjs → postcss-CgFCqilE.mjs} +2 -2
- package/dist/{postcss-Ab7YzAbs.js → postcss-k0BshZZQ.js} +2 -2
- package/dist/postcss.js +1 -1
- package/dist/postcss.mjs +1 -1
- package/dist/{precheck-SG48aLG2.mjs → precheck-DMXLnfTN.mjs} +32 -12
- package/dist/{precheck-CRX-pMKJ.js → precheck-GcUdX1BX.js} +32 -12
- package/dist/presets.js +4 -4
- package/dist/presets.mjs +4 -4
- package/dist/{source-candidates-C4YgmZ8A.js → source-candidates-ES3ttZPe.js} +1 -1
- package/dist/{source-candidates-CyupdLKi.mjs → source-candidates-om5-wQJ0.mjs} +1 -1
- package/dist/{tailwindcss-DZ6jVYb4.js → tailwindcss-CkTBauKa.js} +2 -2
- package/dist/{tailwindcss-BbTVeQkG.mjs → tailwindcss-fe0rGj7T.mjs} +2 -2
- package/dist/types/index.d.ts +7 -1
- package/dist/types/user-defined-options/general.d.ts +2 -0
- package/dist/{v3-engine-D61eilBl.mjs → v3-engine-qoWtwjIj.mjs} +15 -0
- package/dist/{v3-engine-DwV1E6rX.js → v3-engine-v__n8_Sd.js} +15 -0
- package/dist/{vite-xKS6RvLR.js → vite-Bob_Mrva.js} +9 -9
- package/dist/{vite-Ti_qSctn.mjs → vite-cBjGYHFH.mjs} +9 -9
- package/dist/vite.js +1 -1
- package/dist/vite.mjs +1 -1
- package/dist/{webpack-wfNutjMm.js → webpack-BedfyGbF.js} +6 -6
- package/dist/{webpack-DvptFz7B.mjs → webpack-Cq45BZzs.mjs} +6 -6
- package/dist/webpack.js +1 -1
- package/dist/webpack.mjs +1 -1
- package/package.json +4 -4
- /package/dist/{constants-E_loJC49.mjs → constants-BG12WAKw.mjs} +0 -0
- /package/dist/{constants-BoB_6lFw.js → constants-BeeyfJ9k.js} +0 -0
- /package/dist/{logger-Bub1jggA.mjs → logger-CZUxvJJD.mjs} +0 -0
- /package/dist/{logger-BRy6XPQ2.js → logger-EVNB9z7i.js} +0 -0
- /package/dist/{utils-D0MZP_tr.js → utils-4ODFyoqD.js} +0 -0
- /package/dist/{utils-CycMvPn_.mjs → utils-CGBVVNm6.mjs} +0 -0
package/dist/defaults.js
CHANGED
|
@@ -1,151 +1,7 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
require("./
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const HTML_FILE_PATTERN = /.+\.(?:(?:wx|ax|jx|ks|tt|q|ty|xhs)ml|swan)$/;
|
|
9
|
-
const JS_FILE_PATTERN = /.+\.[cm]?js?$/;
|
|
10
|
-
const BACKSLASH_RE = /\\/g;
|
|
11
|
-
function normalizePath(p) {
|
|
12
|
-
return p.replace(BACKSLASH_RE, "/");
|
|
13
|
-
}
|
|
14
|
-
const MPX_STYLES_DIR_PATTERN = /(?:^|\/)styles\/.*\.(?:wx|ac|jx|tt|q|c|ty)ss$/i;
|
|
15
|
-
const KBONE_MAIN_CSS_RE = /^(?:common\/)?miniprogram-app/;
|
|
16
|
-
const IMPLICIT_MAIN_CSS_RE = /^(?:app|common\/main|bundle)(?:\.|\/|$)/;
|
|
17
|
-
const MAIN_CSS_CHUNK_MATCHERS = {
|
|
18
|
-
"uni-app": (file) => file.startsWith("common/main") || file.startsWith("app"),
|
|
19
|
-
"uni-app-vite": (file) => file.startsWith("app") || file.startsWith("common/main"),
|
|
20
|
-
"uni-app-x": (file) => file.startsWith("app") || file.startsWith("common/main"),
|
|
21
|
-
"mpx": (file) => {
|
|
22
|
-
const normalized = normalizePath(file);
|
|
23
|
-
if (normalized.startsWith("app")) return true;
|
|
24
|
-
return MPX_STYLES_DIR_PATTERN.test(normalized);
|
|
25
|
-
},
|
|
26
|
-
"taro": (file) => file.startsWith("app"),
|
|
27
|
-
"remax": (file) => file.startsWith("app"),
|
|
28
|
-
"rax": (file) => file.startsWith("bundle"),
|
|
29
|
-
"native": (file) => file.startsWith("app"),
|
|
30
|
-
"weapp-vite": (file) => file.startsWith("app"),
|
|
31
|
-
"kbone": (file) => KBONE_MAIN_CSS_RE.test(file)
|
|
32
|
-
};
|
|
33
|
-
const alwaysFalse = () => false;
|
|
34
|
-
const TAILWIND_V3_CSS_PREFLIGHT = {
|
|
35
|
-
"box-sizing": "border-box",
|
|
36
|
-
"border-width": "0",
|
|
37
|
-
"border-style": "solid",
|
|
38
|
-
"border-color": "currentColor"
|
|
39
|
-
};
|
|
40
|
-
const TAILWIND_V4_CSS_PREFLIGHT = {
|
|
41
|
-
"box-sizing": "border-box",
|
|
42
|
-
"margin": "0",
|
|
43
|
-
"padding": "0",
|
|
44
|
-
"border": "0 solid"
|
|
45
|
-
};
|
|
46
|
-
function getDefaultCssPreflight(tailwindcssMajorVersion) {
|
|
47
|
-
return { ...tailwindcssMajorVersion === 4 ? TAILWIND_V4_CSS_PREFLIGHT : TAILWIND_V3_CSS_PREFLIGHT };
|
|
48
|
-
}
|
|
49
|
-
function resolveDefaultCssPreflight(cssPreflight, tailwindcssMajorVersion) {
|
|
50
|
-
if (cssPreflight === false) return false;
|
|
51
|
-
return {
|
|
52
|
-
...getDefaultCssPreflight(tailwindcssMajorVersion),
|
|
53
|
-
...cssPreflight ?? {}
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
|
-
function createMainCssChunkMatcher() {
|
|
57
|
-
return (file, appType) => {
|
|
58
|
-
if (!appType) {
|
|
59
|
-
const normalized = normalizePath(file);
|
|
60
|
-
return IMPLICIT_MAIN_CSS_RE.test(normalized) || MPX_STYLES_DIR_PATTERN.test(normalized) || KBONE_MAIN_CSS_RE.test(normalized);
|
|
61
|
-
}
|
|
62
|
-
const matcher = MAIN_CSS_CHUNK_MATCHERS[appType];
|
|
63
|
-
return matcher ? matcher(file) : true;
|
|
64
|
-
};
|
|
65
|
-
}
|
|
66
|
-
function getDefaultOptions() {
|
|
67
|
-
return {
|
|
68
|
-
/**
|
|
69
|
-
* wxss 微信小程序
|
|
70
|
-
* acss 支付宝小程序
|
|
71
|
-
* jxss 京东小程序
|
|
72
|
-
* ttss 头条小程序
|
|
73
|
-
* qss QQ小程序
|
|
74
|
-
* css 最正常的样式文件
|
|
75
|
-
* tyss 涂鸦小程序
|
|
76
|
-
*/
|
|
77
|
-
cssMatcher: (file) => CSS_FILE_PATTERN.test(file),
|
|
78
|
-
/**
|
|
79
|
-
* wxml 微信小程序
|
|
80
|
-
* axml 支付宝小程序
|
|
81
|
-
* jxml 京东小程序
|
|
82
|
-
* ksml 快手小程序
|
|
83
|
-
* ttml 头条小程序
|
|
84
|
-
* qml QQ小程序
|
|
85
|
-
* tyml 涂鸦小程序
|
|
86
|
-
* xhsml 小红书小程序
|
|
87
|
-
* swan 百度小程序
|
|
88
|
-
*/
|
|
89
|
-
htmlMatcher: (file) => HTML_FILE_PATTERN.test(file),
|
|
90
|
-
jsMatcher: (file) => {
|
|
91
|
-
if (file.includes("node_modules")) return false;
|
|
92
|
-
return JS_FILE_PATTERN.test(file);
|
|
93
|
-
},
|
|
94
|
-
mainCssChunkMatcher: createMainCssChunkMatcher(),
|
|
95
|
-
wxsMatcher: alwaysFalse,
|
|
96
|
-
cssPreflight: getDefaultCssPreflight(3),
|
|
97
|
-
disabled: false,
|
|
98
|
-
onLoad: _weapp_tailwindcss_shared.noop,
|
|
99
|
-
onStart: _weapp_tailwindcss_shared.noop,
|
|
100
|
-
onEnd: _weapp_tailwindcss_shared.noop,
|
|
101
|
-
onUpdate: _weapp_tailwindcss_shared.noop,
|
|
102
|
-
customAttributes: {},
|
|
103
|
-
customReplaceDictionary: _weapp_core_escape.MappingChars2String,
|
|
104
|
-
appType: void 0,
|
|
105
|
-
arbitraryValues: {
|
|
106
|
-
allowDoubleQuotes: false,
|
|
107
|
-
bareArbitraryValues: false
|
|
108
|
-
},
|
|
109
|
-
cssChildCombinatorReplaceValue: ["view", "text"],
|
|
110
|
-
inlineWxs: false,
|
|
111
|
-
injectAdditionalCssVarScope: false,
|
|
112
|
-
jsPreserveClass: (keyword) => {
|
|
113
|
-
/**
|
|
114
|
-
* 默认保留 keyword
|
|
115
|
-
*/
|
|
116
|
-
if (keyword === "*") return true;
|
|
117
|
-
return false;
|
|
118
|
-
},
|
|
119
|
-
disabledDefaultTemplateHandler: false,
|
|
120
|
-
cssSelectorReplacement: {
|
|
121
|
-
root: [
|
|
122
|
-
"page",
|
|
123
|
-
".tw-root",
|
|
124
|
-
"wx-root-portal-content"
|
|
125
|
-
],
|
|
126
|
-
universal: ["view", "text"]
|
|
127
|
-
},
|
|
128
|
-
babelParserOptions: {
|
|
129
|
-
sourceType: "unambiguous",
|
|
130
|
-
cache: true,
|
|
131
|
-
cacheKey: "st:unambiguous"
|
|
132
|
-
},
|
|
133
|
-
postcssOptions: {},
|
|
134
|
-
cssRemoveProperty: true,
|
|
135
|
-
cssRemoveHoverPseudoClass: true,
|
|
136
|
-
ignoreCallExpressionIdentifiers: [],
|
|
137
|
-
ignoreTaggedTemplateExpressionIdentifiers: ["weappTwIgnore"],
|
|
138
|
-
replaceRuntimePackages: false,
|
|
139
|
-
generator: { target: "weapp" },
|
|
140
|
-
tailwindcssPatcherOptions: { filter(className) {
|
|
141
|
-
return !(0, _weapp_core_escape.isAllowedClassName)(className);
|
|
142
|
-
} },
|
|
143
|
-
logLevel: "info"
|
|
144
|
-
};
|
|
145
|
-
}
|
|
146
|
-
//#endregion
|
|
147
|
-
exports.TAILWIND_V3_CSS_PREFLIGHT = TAILWIND_V3_CSS_PREFLIGHT;
|
|
148
|
-
exports.TAILWIND_V4_CSS_PREFLIGHT = TAILWIND_V4_CSS_PREFLIGHT;
|
|
149
|
-
exports.getDefaultCssPreflight = getDefaultCssPreflight;
|
|
150
|
-
exports.getDefaultOptions = getDefaultOptions;
|
|
151
|
-
exports.resolveDefaultCssPreflight = resolveDefaultCssPreflight;
|
|
2
|
+
const require_defaults = require("./defaults-IHhYxNeU.js");
|
|
3
|
+
exports.TAILWIND_V3_CSS_PREFLIGHT = require_defaults.TAILWIND_V3_CSS_PREFLIGHT;
|
|
4
|
+
exports.TAILWIND_V4_CSS_PREFLIGHT = require_defaults.TAILWIND_V4_CSS_PREFLIGHT;
|
|
5
|
+
exports.getDefaultCssPreflight = require_defaults.getDefaultCssPreflight;
|
|
6
|
+
exports.getDefaultOptions = require_defaults.getDefaultOptions;
|
|
7
|
+
exports.resolveDefaultCssPreflight = require_defaults.resolveDefaultCssPreflight;
|
package/dist/defaults.mjs
CHANGED
|
@@ -1,144 +1,2 @@
|
|
|
1
|
-
import { a as
|
|
2
|
-
import { MappingChars2String, isAllowedClassName } from "@weapp-core/escape";
|
|
3
|
-
//#region src/defaults.ts
|
|
4
|
-
const CSS_FILE_PATTERN = /.+\.(?:wx|ac|jx|tt|q|c|ty)ss$/;
|
|
5
|
-
const HTML_FILE_PATTERN = /.+\.(?:(?:wx|ax|jx|ks|tt|q|ty|xhs)ml|swan)$/;
|
|
6
|
-
const JS_FILE_PATTERN = /.+\.[cm]?js?$/;
|
|
7
|
-
const BACKSLASH_RE = /\\/g;
|
|
8
|
-
function normalizePath(p) {
|
|
9
|
-
return p.replace(BACKSLASH_RE, "/");
|
|
10
|
-
}
|
|
11
|
-
const MPX_STYLES_DIR_PATTERN = /(?:^|\/)styles\/.*\.(?:wx|ac|jx|tt|q|c|ty)ss$/i;
|
|
12
|
-
const KBONE_MAIN_CSS_RE = /^(?:common\/)?miniprogram-app/;
|
|
13
|
-
const IMPLICIT_MAIN_CSS_RE = /^(?:app|common\/main|bundle)(?:\.|\/|$)/;
|
|
14
|
-
const MAIN_CSS_CHUNK_MATCHERS = {
|
|
15
|
-
"uni-app": (file) => file.startsWith("common/main") || file.startsWith("app"),
|
|
16
|
-
"uni-app-vite": (file) => file.startsWith("app") || file.startsWith("common/main"),
|
|
17
|
-
"uni-app-x": (file) => file.startsWith("app") || file.startsWith("common/main"),
|
|
18
|
-
"mpx": (file) => {
|
|
19
|
-
const normalized = normalizePath(file);
|
|
20
|
-
if (normalized.startsWith("app")) return true;
|
|
21
|
-
return MPX_STYLES_DIR_PATTERN.test(normalized);
|
|
22
|
-
},
|
|
23
|
-
"taro": (file) => file.startsWith("app"),
|
|
24
|
-
"remax": (file) => file.startsWith("app"),
|
|
25
|
-
"rax": (file) => file.startsWith("bundle"),
|
|
26
|
-
"native": (file) => file.startsWith("app"),
|
|
27
|
-
"weapp-vite": (file) => file.startsWith("app"),
|
|
28
|
-
"kbone": (file) => KBONE_MAIN_CSS_RE.test(file)
|
|
29
|
-
};
|
|
30
|
-
const alwaysFalse = () => false;
|
|
31
|
-
const TAILWIND_V3_CSS_PREFLIGHT = {
|
|
32
|
-
"box-sizing": "border-box",
|
|
33
|
-
"border-width": "0",
|
|
34
|
-
"border-style": "solid",
|
|
35
|
-
"border-color": "currentColor"
|
|
36
|
-
};
|
|
37
|
-
const TAILWIND_V4_CSS_PREFLIGHT = {
|
|
38
|
-
"box-sizing": "border-box",
|
|
39
|
-
"margin": "0",
|
|
40
|
-
"padding": "0",
|
|
41
|
-
"border": "0 solid"
|
|
42
|
-
};
|
|
43
|
-
function getDefaultCssPreflight(tailwindcssMajorVersion) {
|
|
44
|
-
return { ...tailwindcssMajorVersion === 4 ? TAILWIND_V4_CSS_PREFLIGHT : TAILWIND_V3_CSS_PREFLIGHT };
|
|
45
|
-
}
|
|
46
|
-
function resolveDefaultCssPreflight(cssPreflight, tailwindcssMajorVersion) {
|
|
47
|
-
if (cssPreflight === false) return false;
|
|
48
|
-
return {
|
|
49
|
-
...getDefaultCssPreflight(tailwindcssMajorVersion),
|
|
50
|
-
...cssPreflight ?? {}
|
|
51
|
-
};
|
|
52
|
-
}
|
|
53
|
-
function createMainCssChunkMatcher() {
|
|
54
|
-
return (file, appType) => {
|
|
55
|
-
if (!appType) {
|
|
56
|
-
const normalized = normalizePath(file);
|
|
57
|
-
return IMPLICIT_MAIN_CSS_RE.test(normalized) || MPX_STYLES_DIR_PATTERN.test(normalized) || KBONE_MAIN_CSS_RE.test(normalized);
|
|
58
|
-
}
|
|
59
|
-
const matcher = MAIN_CSS_CHUNK_MATCHERS[appType];
|
|
60
|
-
return matcher ? matcher(file) : true;
|
|
61
|
-
};
|
|
62
|
-
}
|
|
63
|
-
function getDefaultOptions() {
|
|
64
|
-
return {
|
|
65
|
-
/**
|
|
66
|
-
* wxss 微信小程序
|
|
67
|
-
* acss 支付宝小程序
|
|
68
|
-
* jxss 京东小程序
|
|
69
|
-
* ttss 头条小程序
|
|
70
|
-
* qss QQ小程序
|
|
71
|
-
* css 最正常的样式文件
|
|
72
|
-
* tyss 涂鸦小程序
|
|
73
|
-
*/
|
|
74
|
-
cssMatcher: (file) => CSS_FILE_PATTERN.test(file),
|
|
75
|
-
/**
|
|
76
|
-
* wxml 微信小程序
|
|
77
|
-
* axml 支付宝小程序
|
|
78
|
-
* jxml 京东小程序
|
|
79
|
-
* ksml 快手小程序
|
|
80
|
-
* ttml 头条小程序
|
|
81
|
-
* qml QQ小程序
|
|
82
|
-
* tyml 涂鸦小程序
|
|
83
|
-
* xhsml 小红书小程序
|
|
84
|
-
* swan 百度小程序
|
|
85
|
-
*/
|
|
86
|
-
htmlMatcher: (file) => HTML_FILE_PATTERN.test(file),
|
|
87
|
-
jsMatcher: (file) => {
|
|
88
|
-
if (file.includes("node_modules")) return false;
|
|
89
|
-
return JS_FILE_PATTERN.test(file);
|
|
90
|
-
},
|
|
91
|
-
mainCssChunkMatcher: createMainCssChunkMatcher(),
|
|
92
|
-
wxsMatcher: alwaysFalse,
|
|
93
|
-
cssPreflight: getDefaultCssPreflight(3),
|
|
94
|
-
disabled: false,
|
|
95
|
-
onLoad: noop,
|
|
96
|
-
onStart: noop,
|
|
97
|
-
onEnd: noop,
|
|
98
|
-
onUpdate: noop,
|
|
99
|
-
customAttributes: {},
|
|
100
|
-
customReplaceDictionary: MappingChars2String,
|
|
101
|
-
appType: void 0,
|
|
102
|
-
arbitraryValues: {
|
|
103
|
-
allowDoubleQuotes: false,
|
|
104
|
-
bareArbitraryValues: false
|
|
105
|
-
},
|
|
106
|
-
cssChildCombinatorReplaceValue: ["view", "text"],
|
|
107
|
-
inlineWxs: false,
|
|
108
|
-
injectAdditionalCssVarScope: false,
|
|
109
|
-
jsPreserveClass: (keyword) => {
|
|
110
|
-
/**
|
|
111
|
-
* 默认保留 keyword
|
|
112
|
-
*/
|
|
113
|
-
if (keyword === "*") return true;
|
|
114
|
-
return false;
|
|
115
|
-
},
|
|
116
|
-
disabledDefaultTemplateHandler: false,
|
|
117
|
-
cssSelectorReplacement: {
|
|
118
|
-
root: [
|
|
119
|
-
"page",
|
|
120
|
-
".tw-root",
|
|
121
|
-
"wx-root-portal-content"
|
|
122
|
-
],
|
|
123
|
-
universal: ["view", "text"]
|
|
124
|
-
},
|
|
125
|
-
babelParserOptions: {
|
|
126
|
-
sourceType: "unambiguous",
|
|
127
|
-
cache: true,
|
|
128
|
-
cacheKey: "st:unambiguous"
|
|
129
|
-
},
|
|
130
|
-
postcssOptions: {},
|
|
131
|
-
cssRemoveProperty: true,
|
|
132
|
-
cssRemoveHoverPseudoClass: true,
|
|
133
|
-
ignoreCallExpressionIdentifiers: [],
|
|
134
|
-
ignoreTaggedTemplateExpressionIdentifiers: ["weappTwIgnore"],
|
|
135
|
-
replaceRuntimePackages: false,
|
|
136
|
-
generator: { target: "weapp" },
|
|
137
|
-
tailwindcssPatcherOptions: { filter(className) {
|
|
138
|
-
return !isAllowedClassName(className);
|
|
139
|
-
} },
|
|
140
|
-
logLevel: "info"
|
|
141
|
-
};
|
|
142
|
-
}
|
|
143
|
-
//#endregion
|
|
1
|
+
import { a as resolveDefaultCssPreflight, i as getDefaultOptions, n as TAILWIND_V4_CSS_PREFLIGHT, r as getDefaultCssPreflight, t as TAILWIND_V3_CSS_PREFLIGHT } from "./defaults-B1igPF_e.mjs";
|
|
144
2
|
export { TAILWIND_V3_CSS_PREFLIGHT, TAILWIND_V4_CSS_PREFLIGHT, getDefaultCssPreflight, getDefaultOptions, resolveDefaultCssPreflight };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as createTailwindV4Engine, i as createTailwindV3Engine, n as resolveTailwindV3SourceFromPatcher, x as resolveTailwindV4SourceFromPatcher } from "./v3-engine-
|
|
1
|
+
import { C as createTailwindV4Engine, i as createTailwindV3Engine, n as resolveTailwindV3SourceFromPatcher, x as resolveTailwindV4SourceFromPatcher } from "./v3-engine-qoWtwjIj.mjs";
|
|
2
2
|
//#region src/generator/options.ts
|
|
3
3
|
function normalizeWeappTailwindcssGeneratorOptions(options) {
|
|
4
4
|
if (options == null) return {
|
package/dist/generator.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
require("./chunk-8l464Juk.js");
|
|
3
|
-
const require_v3_engine = require("./v3-engine-
|
|
4
|
-
const require_generator = require("./generator-
|
|
3
|
+
const require_v3_engine = require("./v3-engine-v__n8_Sd.js");
|
|
4
|
+
const require_generator = require("./generator-CImaTibB.js");
|
|
5
5
|
let tailwindcss_patch = require("tailwindcss-patch");
|
|
6
6
|
exports.createWeappTailwindcssGenerator = require_generator.createWeappTailwindcssGenerator;
|
|
7
7
|
exports.createWeappTailwindcssGeneratorFromPatcher = require_generator.createWeappTailwindcssGeneratorFromPatcher;
|
package/dist/generator.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { S as resolveTailwindV4SourceOptionsFromPatcher, T as transformTailwindV4CssToWeapp, a as transformTailwindV3CssByTarget, b as resolveTailwindV4SourceFromPatchOptions, n as resolveTailwindV3SourceFromPatcher, o as transformTailwindV3CssToWeapp, r as resolveTailwindV3SourceOptionsFromPatcher, t as resolveTailwindV3Source, w as transformTailwindV4CssByTarget, x as resolveTailwindV4SourceFromPatcher, y as resolveTailwindV4Source } from "./v3-engine-
|
|
2
|
-
import { i as normalizeWeappTailwindcssGeneratorOptions, n as createWeappTailwindcssGeneratorFromPatcher, r as resolveTailwindSourceFromPatcher, t as createWeappTailwindcssGenerator } from "./generator-
|
|
1
|
+
import { S as resolveTailwindV4SourceOptionsFromPatcher, T as transformTailwindV4CssToWeapp, a as transformTailwindV3CssByTarget, b as resolveTailwindV4SourceFromPatchOptions, n as resolveTailwindV3SourceFromPatcher, o as transformTailwindV3CssToWeapp, r as resolveTailwindV3SourceOptionsFromPatcher, t as resolveTailwindV3Source, w as transformTailwindV4CssByTarget, x as resolveTailwindV4SourceFromPatcher, y as resolveTailwindV4Source } from "./v3-engine-qoWtwjIj.mjs";
|
|
2
|
+
import { i as normalizeWeappTailwindcssGeneratorOptions, n as createWeappTailwindcssGeneratorFromPatcher, r as resolveTailwindSourceFromPatcher, t as createWeappTailwindcssGenerator } from "./generator-DSMdL4vg.mjs";
|
|
3
3
|
export { createWeappTailwindcssGenerator, createWeappTailwindcssGeneratorFromPatcher, normalizeWeappTailwindcssGeneratorOptions, resolveTailwindSourceFromPatcher, resolveTailwindV3Source, resolveTailwindV3SourceFromPatcher, resolveTailwindV3SourceOptionsFromPatcher, resolveTailwindV4Source, resolveTailwindV4SourceFromPatchOptions, resolveTailwindV4SourceFromPatcher, resolveTailwindV4SourceOptionsFromPatcher, transformTailwindV3CssByTarget, transformTailwindV3CssToWeapp, transformTailwindV4CssByTarget, transformTailwindV4CssToWeapp };
|
package/dist/gulp.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_chunk = require("./chunk-8l464Juk.js");
|
|
3
|
-
const require_v3_engine = require("./v3-engine-
|
|
4
|
-
const require_incremental_runtime_class_set = require("./incremental-runtime-class-set-
|
|
5
|
-
const require_precheck = require("./precheck-
|
|
6
|
-
const require_tailwindcss = require("./tailwindcss-
|
|
7
|
-
const require_source_candidates = require("./source-candidates-
|
|
3
|
+
const require_v3_engine = require("./v3-engine-v__n8_Sd.js");
|
|
4
|
+
const require_incremental_runtime_class_set = require("./incremental-runtime-class-set-CH1L--wj.js");
|
|
5
|
+
const require_precheck = require("./precheck-GcUdX1BX.js");
|
|
6
|
+
const require_tailwindcss = require("./tailwindcss-CkTBauKa.js");
|
|
7
|
+
const require_source_candidates = require("./source-candidates-ES3ttZPe.js");
|
|
8
8
|
let node_fs = require("node:fs");
|
|
9
9
|
node_fs = require_chunk.__toESM(node_fs);
|
|
10
10
|
let node_path = require("node:path");
|
package/dist/gulp.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { F as createDebug, _ as resolveViteSourceScanEntries, l as getRuntimeClassSetSignature } from "./v3-engine-
|
|
2
|
-
import { i as generateCssByGenerator, l as normalizeTailwindSourceForGenerator, o as processCachedTask, r as emitHmrTiming, s as hasTailwindRootDirectives, t as createBundleRuntimeClassSetManager } from "./incremental-runtime-class-set-
|
|
3
|
-
import { _ as ensureRuntimeClassSet, g as createTailwindRuntimeReadyPromise, n as getCompilerContext, t as shouldSkipJsTransform } from "./precheck-
|
|
4
|
-
import { c as upsertTailwindV4CssSource, s as hasConfiguredTailwindV4CssRoots } from "./tailwindcss-
|
|
5
|
-
import { t as createSourceCandidateCollector } from "./source-candidates-
|
|
1
|
+
import { F as createDebug, _ as resolveViteSourceScanEntries, l as getRuntimeClassSetSignature } from "./v3-engine-qoWtwjIj.mjs";
|
|
2
|
+
import { i as generateCssByGenerator, l as normalizeTailwindSourceForGenerator, o as processCachedTask, r as emitHmrTiming, s as hasTailwindRootDirectives, t as createBundleRuntimeClassSetManager } from "./incremental-runtime-class-set-P-3ZoWW5.mjs";
|
|
3
|
+
import { _ as ensureRuntimeClassSet, g as createTailwindRuntimeReadyPromise, n as getCompilerContext, t as shouldSkipJsTransform } from "./precheck-DMXLnfTN.mjs";
|
|
4
|
+
import { c as upsertTailwindV4CssSource, s as hasConfiguredTailwindV4CssRoots } from "./tailwindcss-fe0rGj7T.mjs";
|
|
5
|
+
import { t as createSourceCandidateCollector } from "./source-candidates-om5-wQJ0.mjs";
|
|
6
6
|
import fs from "node:fs";
|
|
7
7
|
import path from "node:path";
|
|
8
8
|
import process from "node:process";
|
package/dist/{incremental-runtime-class-set-DN9KKjSi.js → incremental-runtime-class-set-CH1L--wj.js}
RENAMED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
const require_chunk = require("./chunk-8l464Juk.js");
|
|
2
|
-
const require_v3_engine = require("./v3-engine-
|
|
3
|
-
const require_generator = require("./generator-
|
|
4
|
-
const require_precheck = require("./precheck-
|
|
5
|
-
const require_tailwindcss = require("./tailwindcss-
|
|
2
|
+
const require_v3_engine = require("./v3-engine-v__n8_Sd.js");
|
|
3
|
+
const require_generator = require("./generator-CImaTibB.js");
|
|
4
|
+
const require_precheck = require("./precheck-GcUdX1BX.js");
|
|
5
|
+
const require_tailwindcss = require("./tailwindcss-CkTBauKa.js");
|
|
6
6
|
let node_fs = require("node:fs");
|
|
7
7
|
let postcss = require("postcss");
|
|
8
8
|
postcss = require_chunk.__toESM(postcss);
|
|
@@ -17,6 +17,7 @@ const TAILWIND_GENERATED_CSS_MARKER_RE = /\/\*!\s*tailwindcss v|@property\s+--tw
|
|
|
17
17
|
const GENERATOR_PLACEHOLDER_MARKER_RE = /\/\*!\s*weapp-tailwindcss generator-placeholder\s*\*\//i;
|
|
18
18
|
const GENERATOR_PLACEHOLDER_MARKER_GLOBAL_RE = /\/\*!\s*weapp-tailwindcss generator-placeholder\s*\*\/\s*/gi;
|
|
19
19
|
const TAILWIND_BANNER_PREFIX_RE = /^\/\*!\s*tailwindcss v[^*]*\*\/\s*/i;
|
|
20
|
+
const TAILWIND_BANNER_RE = /\/\*!\s*tailwindcss v[^*]*\*\//i;
|
|
20
21
|
const TAILWIND_BANNER_GLOBAL_RE = /\/\*!\s*tailwindcss v[^*]*\*\/\s*/gi;
|
|
21
22
|
const VITE_MARKER_RE = /\/\*\$vite\$:[^*]*\*\//g;
|
|
22
23
|
function createCssAppend(base, extra) {
|
|
@@ -24,14 +25,31 @@ function createCssAppend(base, extra) {
|
|
|
24
25
|
if (!extra) return base;
|
|
25
26
|
return `${base}\n${extra}`;
|
|
26
27
|
}
|
|
27
|
-
function
|
|
28
|
+
function splitTailwindV4GeneratedCssBySourceOrder(rawSource, rawTailwindCss) {
|
|
28
29
|
const trimmedRaw = rawSource.trim();
|
|
29
30
|
const trimmedTailwind = rawTailwindCss.trim();
|
|
30
|
-
if (trimmedRaw === trimmedTailwind) return
|
|
31
|
-
|
|
31
|
+
if (trimmedRaw === trimmedTailwind) return {
|
|
32
|
+
before: "",
|
|
33
|
+
after: ""
|
|
34
|
+
};
|
|
35
|
+
if (trimmedTailwind.startsWith(trimmedRaw)) return {
|
|
36
|
+
before: "",
|
|
37
|
+
after: ""
|
|
38
|
+
};
|
|
32
39
|
const start = rawSource.indexOf(rawTailwindCss);
|
|
33
40
|
if (start === -1) return;
|
|
34
|
-
return
|
|
41
|
+
return {
|
|
42
|
+
before: rawSource.slice(0, start),
|
|
43
|
+
after: rawSource.slice(start + rawTailwindCss.length)
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
function splitTailwindGeneratedCssByBanner(rawSource, start) {
|
|
47
|
+
const match = start === void 0 ? TAILWIND_BANNER_RE.exec(rawSource) : { index: start };
|
|
48
|
+
if (!match || match.index === void 0) return;
|
|
49
|
+
return {
|
|
50
|
+
before: rawSource.slice(0, match.index),
|
|
51
|
+
after: [...rawSource.slice(match.index).matchAll(VITE_MARKER_RE)].map((item) => item[0]).join("\n")
|
|
52
|
+
};
|
|
35
53
|
}
|
|
36
54
|
function stripTailwindBanner(css) {
|
|
37
55
|
return css.replace(TAILWIND_BANNER_PREFIX_RE, "");
|
|
@@ -1595,7 +1613,7 @@ const REMOTE_IMPORT_RE = /^(?:https?:)?\/\//i;
|
|
|
1595
1613
|
function finalizeMiniProgramGeneratorCss(css, target, majorVersion, cssPreflight) {
|
|
1596
1614
|
if (target !== "weapp") return css;
|
|
1597
1615
|
return finalizeMiniProgramCss(css, {
|
|
1598
|
-
cssPreflight,
|
|
1616
|
+
cssPreflight: majorVersion === 4 ? cssPreflight : void 0,
|
|
1599
1617
|
preservePseudoContentInit: majorVersion === 3
|
|
1600
1618
|
});
|
|
1601
1619
|
}
|
|
@@ -1635,6 +1653,39 @@ function resolveGeneratorStyleOptions(opts, cssHandlerOptions, generatorStyleOpt
|
|
|
1635
1653
|
function isLocalImportRequest(request) {
|
|
1636
1654
|
return request.length > 0 && !request.startsWith("tailwindcss") && !request.startsWith("weapp-tailwindcss") && !request.startsWith("data:") && !REMOTE_IMPORT_RE.test(request);
|
|
1637
1655
|
}
|
|
1656
|
+
function isCommentOnlyCss(source) {
|
|
1657
|
+
try {
|
|
1658
|
+
const root = postcss.default.parse(source);
|
|
1659
|
+
return root.nodes.length > 0 && root.nodes.every((node) => node.type === "comment");
|
|
1660
|
+
} catch {
|
|
1661
|
+
return false;
|
|
1662
|
+
}
|
|
1663
|
+
}
|
|
1664
|
+
function createCssSourceOrderAppend(base, extra) {
|
|
1665
|
+
if (!base) return extra;
|
|
1666
|
+
if (!extra) return base;
|
|
1667
|
+
if (/\s$/.test(base) || /^\s/.test(extra)) return `${base}${extra}`;
|
|
1668
|
+
return `${base}\n${extra}`;
|
|
1669
|
+
}
|
|
1670
|
+
function splitRawSourceByGeneratedCssOrder(rawSource, rawTailwindCss) {
|
|
1671
|
+
const exactParts = splitTailwindV4GeneratedCssBySourceOrder(rawSource, rawTailwindCss);
|
|
1672
|
+
if (exactParts) return exactParts;
|
|
1673
|
+
return splitTailwindGeneratedCssByBanner(rawSource);
|
|
1674
|
+
}
|
|
1675
|
+
async function transformGeneratorUserCss(source, options) {
|
|
1676
|
+
if (source.trim().length === 0) return "";
|
|
1677
|
+
const cleanedSource = removeTailwindSourceDirectives(source, { importFallback: options.importFallback });
|
|
1678
|
+
if (cleanedSource.trim().length === 0) return "";
|
|
1679
|
+
const extraSource = options.generatorTarget === "weapp" ? removeUnsupportedMiniProgramAtRules(cleanedSource) : cleanedSource;
|
|
1680
|
+
if (extraSource.trim().length === 0) return "";
|
|
1681
|
+
if (isCommentOnlyCss(extraSource)) return extraSource;
|
|
1682
|
+
if (options.generatorTarget !== "weapp") return extraSource;
|
|
1683
|
+
const { css } = await options.styleHandler(extraSource, {
|
|
1684
|
+
...options.generatorStyleOptions,
|
|
1685
|
+
...options.cssUserHandlerOptions
|
|
1686
|
+
});
|
|
1687
|
+
return removeUnsupportedMiniProgramAtRules(css);
|
|
1688
|
+
}
|
|
1638
1689
|
function isPureLocalCssImportWrapper(css) {
|
|
1639
1690
|
let hasImport = false;
|
|
1640
1691
|
try {
|
|
@@ -1756,29 +1807,21 @@ async function generateCssByGenerator(options) {
|
|
|
1756
1807
|
incremental: true
|
|
1757
1808
|
};
|
|
1758
1809
|
}
|
|
1759
|
-
const
|
|
1760
|
-
|
|
1810
|
+
const hasMatchedCssSourceFile = sources.some((source) => source.__weappTailwindcssMeta?.matchedCssSourceFile);
|
|
1811
|
+
const orderedExtraCss = hasMatchedCssSourceFile ? splitTailwindV4GeneratedCssBySourceOrder(effectiveRawSource, generated.rawCss) : splitRawSourceByGeneratedCssOrder(effectiveRawSource, generated.rawCss);
|
|
1812
|
+
if (orderedExtraCss) {
|
|
1761
1813
|
let css = stripTailwindBanner(generated.css);
|
|
1762
1814
|
if (generated.target === "weapp") css = inheritLegacyUnitConvertedDeclarations(css, effectiveRawSource);
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
if (generated.target === "weapp") {
|
|
1774
|
-
const { css: userCss } = await styleHandler(extraSource, {
|
|
1775
|
-
...generatorStyleOptions,
|
|
1776
|
-
...cssUserHandlerOptions
|
|
1777
|
-
});
|
|
1778
|
-
css = createCssAppend(css, removeUnsupportedMiniProgramAtRules(userCss));
|
|
1779
|
-
} else css = createCssAppend(css, extraSource);
|
|
1780
|
-
}
|
|
1781
|
-
}
|
|
1815
|
+
const userCssOptions = {
|
|
1816
|
+
generatorTarget: generated.target,
|
|
1817
|
+
generatorStyleOptions,
|
|
1818
|
+
cssUserHandlerOptions,
|
|
1819
|
+
styleHandler,
|
|
1820
|
+
importFallback: generatorOptions.importFallback
|
|
1821
|
+
};
|
|
1822
|
+
const beforeUserCss = await transformGeneratorUserCss(orderedExtraCss.before, userCssOptions);
|
|
1823
|
+
const afterUserCss = await transformGeneratorUserCss(orderedExtraCss.after, userCssOptions);
|
|
1824
|
+
css = createCssSourceOrderAppend(createCssSourceOrderAppend(beforeUserCss, css), afterUserCss);
|
|
1782
1825
|
if (generated.target === "weapp") {
|
|
1783
1826
|
css = await appendLegacyCompatCss(css, effectiveRawSource, generated.target, styleHandler, cssHandlerOptions, generatorStyleOptions);
|
|
1784
1827
|
css = await appendLegacyContainerCompatCss(css, effectiveRawSource, file, runtime, configuredContainerCompat, generated.target, styleHandler, cssHandlerOptions, generatorStyleOptions);
|
|
@@ -1793,7 +1836,7 @@ async function generateCssByGenerator(options) {
|
|
|
1793
1836
|
debug("tailwind direct css generation prefix mismatch, append transformed bundle css %s", file);
|
|
1794
1837
|
let css = stripTailwindBanner(generated.css);
|
|
1795
1838
|
if (generated.target === "weapp") css = inheritLegacyUnitConvertedDeclarations(css, effectiveRawSource);
|
|
1796
|
-
if (
|
|
1839
|
+
if (hasMatchedCssSourceFile) return {
|
|
1797
1840
|
css: finalizeMiniProgramGeneratorCss(css, generated.target, majorVersion, opts.cssPreflight),
|
|
1798
1841
|
target: generated.target,
|
|
1799
1842
|
source: "generator",
|