weapp-tailwindcss 4.1.5 → 4.1.6

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.
Files changed (43) hide show
  1. package/css/rgb.css +268 -0
  2. package/css/uni-app-x/preflight.css +16 -0
  3. package/css/uni-app-x.css +4 -0
  4. package/css/weapp-theme.css +0 -0
  5. package/dist/{chunk-XRPBGBW5.mjs → chunk-2S365AJ6.mjs} +10 -5
  6. package/dist/{chunk-BOYBKFXU.mjs → chunk-7T4SM5CA.mjs} +2 -2
  7. package/dist/{chunk-YOYWDNJI.js → chunk-DIMGI7MP.js} +10 -5
  8. package/dist/chunk-E4KRP5NR.js +252 -0
  9. package/dist/{chunk-3LFHAVFB.mjs → chunk-I7I27B5D.mjs} +1 -1
  10. package/dist/chunk-JTKQH7XH.mjs +252 -0
  11. package/dist/chunk-OXASK55Q.js +6 -0
  12. package/dist/chunk-PMF2CCKK.mjs +6 -0
  13. package/dist/{chunk-J7NJDCHZ.js → chunk-QGBHJWZN.js} +2 -2
  14. package/dist/{chunk-GZNNW4A3.js → chunk-QINVU3VE.js} +3 -3
  15. package/dist/cli.js +6 -8
  16. package/dist/cli.mjs +4 -6
  17. package/dist/core.js +2 -2
  18. package/dist/core.mjs +1 -1
  19. package/dist/gulp.js +3 -3
  20. package/dist/gulp.mjs +2 -2
  21. package/dist/index.d.mts +1 -1
  22. package/dist/index.d.ts +1 -1
  23. package/dist/index.js +9 -5
  24. package/dist/index.mjs +10 -6
  25. package/dist/presets.d.mts +20 -0
  26. package/dist/presets.d.ts +20 -0
  27. package/dist/presets.js +49 -0
  28. package/dist/presets.mjs +49 -0
  29. package/dist/types.d.mts +8 -0
  30. package/dist/types.d.ts +8 -0
  31. package/dist/vite.d.mts +4 -2
  32. package/dist/vite.d.ts +4 -2
  33. package/dist/vite.js +7 -3
  34. package/dist/vite.mjs +8 -4
  35. package/dist/weapp-tw-runtime-loader.js +5 -28
  36. package/dist/webpack.js +3 -3
  37. package/dist/webpack.mjs +2 -2
  38. package/dist/webpack4.js +3 -3
  39. package/dist/webpack4.mjs +2 -2
  40. package/package.json +12 -3
  41. package/uni-app-x.css +1 -0
  42. package/dist/chunk-3C5J2G6C.js +0 -171
  43. package/dist/chunk-DNHAKEMA.mjs +0 -171
@@ -0,0 +1,252 @@
1
+ import {
2
+ createDebug
3
+ } from "./chunk-3AUX4FGE.mjs";
4
+ import {
5
+ vitePluginName
6
+ } from "./chunk-CMUA5KCO.mjs";
7
+ import {
8
+ getCompilerContext
9
+ } from "./chunk-2S365AJ6.mjs";
10
+ import {
11
+ getGroupedEntries
12
+ } from "./chunk-JXBLHLFR.mjs";
13
+
14
+ // src/bundlers/vite/index.ts
15
+ var debug = createDebug();
16
+ var cssLangs = `\\.(css|less|sass|scss|styl|stylus|pcss|postcss)($|\\?)`;
17
+ var cssLangRE = new RegExp(cssLangs);
18
+ function isCSSRequest(request) {
19
+ return cssLangRE.test(request);
20
+ }
21
+ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
22
+ const opts = getCompilerContext(options);
23
+ const {
24
+ disabled,
25
+ onEnd,
26
+ onLoad,
27
+ onStart,
28
+ onUpdate,
29
+ templateHandler,
30
+ styleHandler,
31
+ jsHandler,
32
+ mainCssChunkMatcher,
33
+ appType,
34
+ setMangleRuntimeSet,
35
+ cache,
36
+ twPatcher,
37
+ uniAppX
38
+ } = opts;
39
+ if (disabled) {
40
+ return;
41
+ }
42
+ twPatcher.patch();
43
+ onLoad();
44
+ const plugins = [
45
+ {
46
+ name: vitePluginName,
47
+ enforce: "post",
48
+ async generateBundle(_opt, bundle) {
49
+ debug("start");
50
+ onStart();
51
+ const entries = Object.entries(bundle);
52
+ const groupedEntries = getGroupedEntries(entries, opts);
53
+ const runtimeSet = await twPatcher.getClassSet();
54
+ setMangleRuntimeSet(runtimeSet);
55
+ debug("get runtimeSet, class count: %d", runtimeSet.size);
56
+ const promises = [];
57
+ if (Array.isArray(groupedEntries.html)) {
58
+ for (const element of groupedEntries.html) {
59
+ const [file, originalSource] = element;
60
+ const oldVal = originalSource.source.toString();
61
+ const hash = cache.computeHash(oldVal);
62
+ cache.calcHashValueChanged(file, hash);
63
+ promises.push(
64
+ cache.process(
65
+ file,
66
+ () => {
67
+ const source = cache.get(file);
68
+ if (source) {
69
+ originalSource.source = source;
70
+ debug("html cache hit: %s", file);
71
+ } else {
72
+ return false;
73
+ }
74
+ },
75
+ async () => {
76
+ originalSource.source = await templateHandler(oldVal, {
77
+ runtimeSet
78
+ });
79
+ onUpdate(file, oldVal, originalSource.source);
80
+ debug("html handle: %s", file);
81
+ return {
82
+ key: file,
83
+ source: originalSource.source
84
+ };
85
+ }
86
+ )
87
+ );
88
+ }
89
+ }
90
+ if (Array.isArray(groupedEntries.js)) {
91
+ for (const element of groupedEntries.js.filter((x) => x[1].type === "chunk")) {
92
+ const [file, originalSource] = element;
93
+ const rawSource = originalSource.code;
94
+ const hash = cache.computeHash(rawSource);
95
+ cache.calcHashValueChanged(file, hash);
96
+ promises.push(
97
+ cache.process(
98
+ file,
99
+ () => {
100
+ const source = cache.get(file);
101
+ if (source) {
102
+ originalSource.code = source;
103
+ debug("js cache hit: %s", file);
104
+ } else {
105
+ return false;
106
+ }
107
+ },
108
+ async () => {
109
+ const mapFilename = `${file}.map`;
110
+ const hasSourceMap = Boolean(bundle[mapFilename]);
111
+ const { code, map } = await jsHandler(rawSource, runtimeSet, {
112
+ generateMap: hasSourceMap
113
+ });
114
+ originalSource.code = code;
115
+ onUpdate(file, rawSource, code);
116
+ debug("js handle: %s", file);
117
+ if (hasSourceMap && map) {
118
+ ;
119
+ bundle[mapFilename].source = map.toString();
120
+ }
121
+ return {
122
+ key: file,
123
+ source: code
124
+ };
125
+ }
126
+ )
127
+ );
128
+ }
129
+ if (uniAppX) {
130
+ for (const element of groupedEntries.js.filter((x) => x[1].type === "asset")) {
131
+ const [file, originalSource] = element;
132
+ const rawSource = originalSource.source.toString();
133
+ const hash = cache.computeHash(rawSource);
134
+ cache.calcHashValueChanged(file, hash);
135
+ promises.push(
136
+ cache.process(
137
+ file,
138
+ () => {
139
+ const source = cache.get(file);
140
+ if (source) {
141
+ originalSource.source = source;
142
+ debug("js cache hit: %s", file);
143
+ } else {
144
+ return false;
145
+ }
146
+ },
147
+ async () => {
148
+ const mapFilename = `${file}.map`;
149
+ const hasSourceMap = Boolean(bundle[mapFilename]);
150
+ const { code, map } = await jsHandler(rawSource, runtimeSet, {
151
+ generateMap: hasSourceMap,
152
+ uniAppX,
153
+ babelParserOptions: {
154
+ plugins: [
155
+ "typescript"
156
+ ],
157
+ sourceType: "unambiguous"
158
+ }
159
+ });
160
+ originalSource.source = code;
161
+ onUpdate(file, rawSource, code);
162
+ debug("js handle: %s", file);
163
+ if (hasSourceMap && map) {
164
+ ;
165
+ bundle[mapFilename].source = map.toString();
166
+ }
167
+ return {
168
+ key: file,
169
+ source: code
170
+ };
171
+ }
172
+ )
173
+ );
174
+ }
175
+ }
176
+ }
177
+ if (Array.isArray(groupedEntries.css)) {
178
+ for (const element of groupedEntries.css) {
179
+ const [file, originalSource] = element;
180
+ const rawSource = originalSource.source.toString();
181
+ const hash = cache.computeHash(rawSource);
182
+ cache.calcHashValueChanged(file, hash);
183
+ promises.push(
184
+ cache.process(
185
+ file,
186
+ () => {
187
+ const source = cache.get(file);
188
+ if (source) {
189
+ originalSource.source = source;
190
+ debug("css cache hit: %s", file);
191
+ } else {
192
+ return false;
193
+ }
194
+ },
195
+ async () => {
196
+ const { css } = await styleHandler(rawSource, {
197
+ isMainChunk: mainCssChunkMatcher(originalSource.fileName, appType),
198
+ postcssOptions: {
199
+ options: {
200
+ from: file
201
+ }
202
+ }
203
+ });
204
+ originalSource.source = css;
205
+ onUpdate(file, rawSource, css);
206
+ debug("css handle: %s", file);
207
+ return {
208
+ key: file,
209
+ source: css
210
+ };
211
+ }
212
+ )
213
+ );
214
+ }
215
+ }
216
+ await Promise.all(promises);
217
+ onEnd();
218
+ debug("end");
219
+ }
220
+ }
221
+ ];
222
+ if (uniAppX) {
223
+ plugins.push(
224
+ {
225
+ name: "weapp-tailwindcss:uni-app-x:css",
226
+ async transform(code, id) {
227
+ if (isCSSRequest(id)) {
228
+ const { css } = await styleHandler(code, {
229
+ isMainChunk: mainCssChunkMatcher(id, appType),
230
+ postcssOptions: {
231
+ options: {
232
+ from: id
233
+ }
234
+ }
235
+ });
236
+ return {
237
+ code: css
238
+ // map,
239
+ };
240
+ }
241
+ }
242
+ }
243
+ );
244
+ }
245
+ return plugins;
246
+ }
247
+
248
+ export {
249
+ cssLangRE,
250
+ isCSSRequest,
251
+ UnifiedViteWeappTailwindcssPlugin
252
+ };
@@ -0,0 +1,6 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});// src/logger/index.ts
2
+ var _logger = require('@weapp-tailwindcss/logger');
3
+
4
+
5
+
6
+ exports.logger = _logger.logger;
@@ -0,0 +1,6 @@
1
+ // src/logger/index.ts
2
+ import { logger } from "@weapp-tailwindcss/logger";
3
+
4
+ export {
5
+ logger
6
+ };
@@ -3,7 +3,7 @@
3
3
  var _chunkLSSLYD6Bjs = require('./chunk-LSSLYD6B.js');
4
4
 
5
5
 
6
- var _chunkYOYWDNJIjs = require('./chunk-YOYWDNJI.js');
6
+ var _chunkDIMGI7MPjs = require('./chunk-DIMGI7MP.js');
7
7
 
8
8
  // src/bundlers/gulp/index.ts
9
9
  var _buffer = require('buffer');
@@ -11,7 +11,7 @@ var _stream = require('stream'); var _stream2 = _interopRequireDefault(_stream);
11
11
  var debug = _chunkLSSLYD6Bjs.createDebug.call(void 0, );
12
12
  var Transform = _stream2.default.Transform;
13
13
  function createPlugins(options = {}) {
14
- const opts = _chunkYOYWDNJIjs.getCompilerContext.call(void 0, options);
14
+ const opts = _chunkDIMGI7MPjs.getCompilerContext.call(void 0, options);
15
15
  const { templateHandler, styleHandler, jsHandler, setMangleRuntimeSet, cache, twPatcher } = opts;
16
16
  let runtimeSet = /* @__PURE__ */ new Set();
17
17
  twPatcher.patch();
@@ -6,7 +6,7 @@ var _chunkLSSLYD6Bjs = require('./chunk-LSSLYD6B.js');
6
6
  var _chunkOGROHM4Ljs = require('./chunk-OGROHM4L.js');
7
7
 
8
8
 
9
- var _chunkYOYWDNJIjs = require('./chunk-YOYWDNJI.js');
9
+ var _chunkDIMGI7MPjs = require('./chunk-DIMGI7MP.js');
10
10
 
11
11
 
12
12
 
@@ -18,7 +18,7 @@ var _path = require('path'); var _path2 = _interopRequireDefault(_path);
18
18
  var debug = _chunkLSSLYD6Bjs.createDebug.call(void 0, );
19
19
  var UnifiedWebpackPluginV5 = class {
20
20
  constructor(options = {}) {
21
- this.options = _chunkYOYWDNJIjs.getCompilerContext.call(void 0, options);
21
+ this.options = _chunkDIMGI7MPjs.getCompilerContext.call(void 0, options);
22
22
  this.appType = this.options.appType;
23
23
  }
24
24
  apply(compiler) {
@@ -45,7 +45,7 @@ var UnifiedWebpackPluginV5 = class {
45
45
  const { ConcatSource, RawSource } = sources;
46
46
  function getClassSetInLoader() {
47
47
  if (twPatcher.majorVersion !== 4) {
48
- return twPatcher.getClassSet();
48
+ return twPatcher.getClassSetV3();
49
49
  }
50
50
  }
51
51
  onLoad();
package/dist/cli.js CHANGED
@@ -1,9 +1,12 @@
1
1
  "use strict"; function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
2
2
 
3
+ var _chunkOXASK55Qjs = require('./chunk-OXASK55Q.js');
4
+
5
+
3
6
  var _chunkOGROHM4Ljs = require('./chunk-OGROHM4L.js');
4
7
 
5
8
 
6
- var _chunkYOYWDNJIjs = require('./chunk-YOYWDNJI.js');
9
+ var _chunkDIMGI7MPjs = require('./chunk-DIMGI7MP.js');
7
10
  require('./chunk-PLMJW644.js');
8
11
  require('./chunk-IS2CB3US.js');
9
12
  require('./chunk-O335YLYH.js');
@@ -13,21 +16,16 @@ require('./chunk-BZ6OV5EP.js');
13
16
  var _process = require('process'); var _process2 = _interopRequireDefault(_process);
14
17
  var _init = require('@weapp-tailwindcss/init');
15
18
  var _semver = require('semver'); var _semver2 = _interopRequireDefault(_semver);
16
-
17
- // src/logger/index.ts
18
- var _logger = require('@weapp-tailwindcss/logger');
19
-
20
- // src/cli.ts
21
19
  _process2.default.title = "node (weapp-tailwindcss)";
22
20
  var args = _process2.default.argv.slice(2);
23
21
  if (_semver2.default.lt(_process2.default.versions.node, _chunkOGROHM4Ljs.WEAPP_TW_REQUIRED_NODE_VERSION)) {
24
- _logger.logger.warn(
22
+ _chunkOXASK55Qjs.logger.warn(
25
23
  `You are using Node.js ${_process2.default.versions.node}. For weapp-tailwindcss, Node.js version >= v${_chunkOGROHM4Ljs.WEAPP_TW_REQUIRED_NODE_VERSION} is required.`
26
24
  );
27
25
  }
28
26
  var command = args[0];
29
27
  if (command === "patch") {
30
- const ctx = _chunkYOYWDNJIjs.getCompilerContext.call(void 0, );
28
+ const ctx = _chunkDIMGI7MPjs.getCompilerContext.call(void 0, );
31
29
  ctx.twPatcher.patch();
32
30
  } else if (command === "init") {
33
31
  _init.init.call(void 0, );
package/dist/cli.mjs CHANGED
@@ -1,9 +1,12 @@
1
+ import {
2
+ logger
3
+ } from "./chunk-PMF2CCKK.mjs";
1
4
  import {
2
5
  WEAPP_TW_REQUIRED_NODE_VERSION
3
6
  } from "./chunk-CMUA5KCO.mjs";
4
7
  import {
5
8
  getCompilerContext
6
- } from "./chunk-XRPBGBW5.mjs";
9
+ } from "./chunk-2S365AJ6.mjs";
7
10
  import "./chunk-Q67IXIAH.mjs";
8
11
  import "./chunk-WKGE3KUO.mjs";
9
12
  import "./chunk-JXBLHLFR.mjs";
@@ -13,11 +16,6 @@ import "./chunk-2LOIH42W.mjs";
13
16
  import process from "node:process";
14
17
  import { init } from "@weapp-tailwindcss/init";
15
18
  import semver from "semver";
16
-
17
- // src/logger/index.ts
18
- import { logger } from "@weapp-tailwindcss/logger";
19
-
20
- // src/cli.ts
21
19
  process.title = "node (weapp-tailwindcss)";
22
20
  var args = process.argv.slice(2);
23
21
  if (semver.lt(process.versions.node, WEAPP_TW_REQUIRED_NODE_VERSION)) {
package/dist/core.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunkYOYWDNJIjs = require('./chunk-YOYWDNJI.js');
3
+ var _chunkDIMGI7MPjs = require('./chunk-DIMGI7MP.js');
4
4
  require('./chunk-PLMJW644.js');
5
5
  require('./chunk-IS2CB3US.js');
6
6
  require('./chunk-O335YLYH.js');
@@ -9,7 +9,7 @@ require('./chunk-BZ6OV5EP.js');
9
9
  // src/core.ts
10
10
  var _shared = require('@weapp-tailwindcss/shared');
11
11
  function createContext(options = {}) {
12
- const opts = _chunkYOYWDNJIjs.getCompilerContext.call(void 0, options);
12
+ const opts = _chunkDIMGI7MPjs.getCompilerContext.call(void 0, options);
13
13
  const { templateHandler, styleHandler, jsHandler, twPatcher } = opts;
14
14
  let runtimeSet = /* @__PURE__ */ new Set();
15
15
  twPatcher.patch();
package/dist/core.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  getCompilerContext
3
- } from "./chunk-XRPBGBW5.mjs";
3
+ } from "./chunk-2S365AJ6.mjs";
4
4
  import "./chunk-Q67IXIAH.mjs";
5
5
  import "./chunk-WKGE3KUO.mjs";
6
6
  import "./chunk-JXBLHLFR.mjs";
package/dist/gulp.js CHANGED
@@ -1,12 +1,12 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunkJ7NJDCHZjs = require('./chunk-J7NJDCHZ.js');
3
+ var _chunkQGBHJWZNjs = require('./chunk-QGBHJWZN.js');
4
4
  require('./chunk-LSSLYD6B.js');
5
- require('./chunk-YOYWDNJI.js');
5
+ require('./chunk-DIMGI7MP.js');
6
6
  require('./chunk-PLMJW644.js');
7
7
  require('./chunk-IS2CB3US.js');
8
8
  require('./chunk-O335YLYH.js');
9
9
  require('./chunk-BZ6OV5EP.js');
10
10
 
11
11
 
12
- exports.createPlugins = _chunkJ7NJDCHZjs.createPlugins;
12
+ exports.createPlugins = _chunkQGBHJWZNjs.createPlugins;
package/dist/gulp.mjs CHANGED
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  createPlugins
3
- } from "./chunk-3LFHAVFB.mjs";
3
+ } from "./chunk-I7I27B5D.mjs";
4
4
  import "./chunk-3AUX4FGE.mjs";
5
- import "./chunk-XRPBGBW5.mjs";
5
+ import "./chunk-2S365AJ6.mjs";
6
6
  import "./chunk-Q67IXIAH.mjs";
7
7
  import "./chunk-WKGE3KUO.mjs";
8
8
  import "./chunk-JXBLHLFR.mjs";
package/dist/index.d.mts CHANGED
@@ -1,6 +1,6 @@
1
1
  export { createPlugins } from './gulp.mjs';
2
2
  export { AppType, CreateJsHandlerOptions, IArbitraryValues, IBaseWebpackPlugin, ICommonReplaceOptions, ICustomAttributes, ICustomAttributesEntities, IJsHandlerOptions, ITemplateHandlerOptions, InternalCssSelectorReplacerOptions, InternalPatchResult, InternalPostcssOptions, InternalUserDefinedOptions, ItemOrItemArray, JsHandler, JsHandlerResult, UserDefinedOptions } from './types.mjs';
3
- export { UnifiedViteWeappTailwindcssPlugin } from './vite.mjs';
3
+ export { UnifiedViteWeappTailwindcssPlugin, cssLangRE, isCSSRequest } from './vite.mjs';
4
4
  export { UnifiedWebpackPluginV5 } from './webpack.mjs';
5
5
  export { CssPreflightOptions, IStyleHandlerOptions } from '@weapp-tailwindcss/postcss';
6
6
  export { IMangleScopeContext } from '@weapp-tailwindcss/mangle';
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  export { createPlugins } from './gulp.js';
2
2
  export { AppType, CreateJsHandlerOptions, IArbitraryValues, IBaseWebpackPlugin, ICommonReplaceOptions, ICustomAttributes, ICustomAttributesEntities, IJsHandlerOptions, ITemplateHandlerOptions, InternalCssSelectorReplacerOptions, InternalPatchResult, InternalPostcssOptions, InternalUserDefinedOptions, ItemOrItemArray, JsHandler, JsHandlerResult, UserDefinedOptions } from './types.js';
3
- export { UnifiedViteWeappTailwindcssPlugin } from './vite.js';
3
+ export { UnifiedViteWeappTailwindcssPlugin, cssLangRE, isCSSRequest } from './vite.js';
4
4
  export { UnifiedWebpackPluginV5 } from './webpack.js';
5
5
  export { CssPreflightOptions, IStyleHandlerOptions } from '@weapp-tailwindcss/postcss';
6
6
  export { IMangleScopeContext } from '@weapp-tailwindcss/mangle';
package/dist/index.js CHANGED
@@ -1,16 +1,18 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});require('./chunk-O2IOQ3BD.js');
2
2
 
3
3
 
4
- var _chunkGZNNW4A3js = require('./chunk-GZNNW4A3.js');
4
+ var _chunkQINVU3VEjs = require('./chunk-QINVU3VE.js');
5
5
 
6
6
 
7
- var _chunkJ7NJDCHZjs = require('./chunk-J7NJDCHZ.js');
7
+ var _chunkQGBHJWZNjs = require('./chunk-QGBHJWZN.js');
8
8
 
9
9
 
10
- var _chunk3C5J2G6Cjs = require('./chunk-3C5J2G6C.js');
10
+
11
+
12
+ var _chunkE4KRP5NRjs = require('./chunk-E4KRP5NR.js');
11
13
  require('./chunk-LSSLYD6B.js');
12
14
  require('./chunk-OGROHM4L.js');
13
- require('./chunk-YOYWDNJI.js');
15
+ require('./chunk-DIMGI7MP.js');
14
16
  require('./chunk-PLMJW644.js');
15
17
  require('./chunk-IS2CB3US.js');
16
18
  require('./chunk-O335YLYH.js');
@@ -19,4 +21,6 @@ require('./chunk-BZ6OV5EP.js');
19
21
 
20
22
 
21
23
 
22
- exports.UnifiedViteWeappTailwindcssPlugin = _chunk3C5J2G6Cjs.UnifiedViteWeappTailwindcssPlugin; exports.UnifiedWebpackPluginV5 = _chunkGZNNW4A3js.UnifiedWebpackPluginV5; exports.createPlugins = _chunkJ7NJDCHZjs.createPlugins;
24
+
25
+
26
+ exports.UnifiedViteWeappTailwindcssPlugin = _chunkE4KRP5NRjs.UnifiedViteWeappTailwindcssPlugin; exports.UnifiedWebpackPluginV5 = _chunkQINVU3VEjs.UnifiedWebpackPluginV5; exports.createPlugins = _chunkQGBHJWZNjs.createPlugins; exports.cssLangRE = _chunkE4KRP5NRjs.cssLangRE; exports.isCSSRequest = _chunkE4KRP5NRjs.isCSSRequest;
package/dist/index.mjs CHANGED
@@ -1,16 +1,18 @@
1
1
  import "./chunk-YAN7TO2B.mjs";
2
2
  import {
3
3
  UnifiedWebpackPluginV5
4
- } from "./chunk-BOYBKFXU.mjs";
4
+ } from "./chunk-7T4SM5CA.mjs";
5
5
  import {
6
6
  createPlugins
7
- } from "./chunk-3LFHAVFB.mjs";
7
+ } from "./chunk-I7I27B5D.mjs";
8
8
  import {
9
- UnifiedViteWeappTailwindcssPlugin
10
- } from "./chunk-DNHAKEMA.mjs";
9
+ UnifiedViteWeappTailwindcssPlugin,
10
+ cssLangRE,
11
+ isCSSRequest
12
+ } from "./chunk-JTKQH7XH.mjs";
11
13
  import "./chunk-3AUX4FGE.mjs";
12
14
  import "./chunk-CMUA5KCO.mjs";
13
- import "./chunk-XRPBGBW5.mjs";
15
+ import "./chunk-2S365AJ6.mjs";
14
16
  import "./chunk-Q67IXIAH.mjs";
15
17
  import "./chunk-WKGE3KUO.mjs";
16
18
  import "./chunk-JXBLHLFR.mjs";
@@ -18,5 +20,7 @@ import "./chunk-2LOIH42W.mjs";
18
20
  export {
19
21
  UnifiedViteWeappTailwindcssPlugin,
20
22
  UnifiedWebpackPluginV5,
21
- createPlugins
23
+ createPlugins,
24
+ cssLangRE,
25
+ isCSSRequest
22
26
  };
@@ -0,0 +1,20 @@
1
+ import { UserDefinedOptions } from './types.mjs';
2
+ import '@babel/parser';
3
+ import '@weapp-tailwindcss/mangle';
4
+ import '@weapp-tailwindcss/postcss';
5
+ import 'magic-string';
6
+ import 'postcss';
7
+ import 'tailwindcss-patch';
8
+ import 'node:buffer';
9
+ import 'webpack';
10
+ import 'lru-cache';
11
+ import 'postcss-preset-env';
12
+
13
+ interface UniAppXOptions {
14
+ base: string;
15
+ rem2rpx?: UserDefinedOptions['rem2rpx'];
16
+ rawOptions?: UserDefinedOptions;
17
+ }
18
+ declare function uniAppX(options: UniAppXOptions): Partial<UserDefinedOptions>;
19
+
20
+ export { type UniAppXOptions, uniAppX };
@@ -0,0 +1,20 @@
1
+ import { UserDefinedOptions } from './types.js';
2
+ import '@babel/parser';
3
+ import '@weapp-tailwindcss/mangle';
4
+ import '@weapp-tailwindcss/postcss';
5
+ import 'magic-string';
6
+ import 'postcss';
7
+ import 'tailwindcss-patch';
8
+ import 'node:buffer';
9
+ import 'webpack';
10
+ import 'lru-cache';
11
+ import 'postcss-preset-env';
12
+
13
+ interface UniAppXOptions {
14
+ base: string;
15
+ rem2rpx?: UserDefinedOptions['rem2rpx'];
16
+ rawOptions?: UserDefinedOptions;
17
+ }
18
+ declare function uniAppX(options: UniAppXOptions): Partial<UserDefinedOptions>;
19
+
20
+ export { type UniAppXOptions, uniAppX };
@@ -0,0 +1,49 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
2
+
3
+ var _chunkOXASK55Qjs = require('./chunk-OXASK55Q.js');
4
+
5
+
6
+ var _chunkO335YLYHjs = require('./chunk-O335YLYH.js');
7
+ require('./chunk-BZ6OV5EP.js');
8
+
9
+ // src/presets.ts
10
+ var _process = require('process'); var _process2 = _interopRequireDefault(_process);
11
+ function uniAppX(options) {
12
+ _chunkOXASK55Qjs.logger.info(`UNI_PLATFORM: ${_process2.default.env.UNI_PLATFORM}`);
13
+ const isApp = _process2.default.env.UNI_PLATFORM === "app" || _process2.default.env.UNI_PLATFORM === "app-plus";
14
+ return _chunkO335YLYHjs.defuOverrideArray.call(void 0,
15
+ options.rawOptions,
16
+ {
17
+ uniAppX: isApp,
18
+ // 安卓
19
+ // ios
20
+ rem2rpx: options.rem2rpx,
21
+ tailwindcssBasedir: options.base,
22
+ tailwindcssPatcherOptions: {
23
+ patch: {
24
+ tailwindcss: {
25
+ v3: {
26
+ cwd: options.base
27
+ },
28
+ v4: {
29
+ base: options.base
30
+ }
31
+ }
32
+ }
33
+ },
34
+ cssPreflight: {
35
+ "border-style": false
36
+ },
37
+ cssPresetEnv: {
38
+ features: {
39
+ "custom-properties": {
40
+ preserve: false
41
+ }
42
+ }
43
+ }
44
+ }
45
+ );
46
+ }
47
+
48
+
49
+ exports.uniAppX = uniAppX;
@@ -0,0 +1,49 @@
1
+ import {
2
+ logger
3
+ } from "./chunk-PMF2CCKK.mjs";
4
+ import {
5
+ defuOverrideArray
6
+ } from "./chunk-JXBLHLFR.mjs";
7
+ import "./chunk-2LOIH42W.mjs";
8
+
9
+ // src/presets.ts
10
+ import process from "node:process";
11
+ function uniAppX(options) {
12
+ logger.info(`UNI_PLATFORM: ${process.env.UNI_PLATFORM}`);
13
+ const isApp = process.env.UNI_PLATFORM === "app" || process.env.UNI_PLATFORM === "app-plus";
14
+ return defuOverrideArray(
15
+ options.rawOptions,
16
+ {
17
+ uniAppX: isApp,
18
+ // 安卓
19
+ // ios
20
+ rem2rpx: options.rem2rpx,
21
+ tailwindcssBasedir: options.base,
22
+ tailwindcssPatcherOptions: {
23
+ patch: {
24
+ tailwindcss: {
25
+ v3: {
26
+ cwd: options.base
27
+ },
28
+ v4: {
29
+ base: options.base
30
+ }
31
+ }
32
+ }
33
+ },
34
+ cssPreflight: {
35
+ "border-style": false
36
+ },
37
+ cssPresetEnv: {
38
+ features: {
39
+ "custom-properties": {
40
+ preserve: false
41
+ }
42
+ }
43
+ }
44
+ }
45
+ );
46
+ }
47
+ export {
48
+ uniAppX
49
+ };
package/dist/types.d.mts CHANGED
@@ -219,6 +219,13 @@ interface UserDefinedOptions {
219
219
  * @description 配置不同版本 tailwindcss 的行为
220
220
  */
221
221
  tailwindcss?: PatchOptions['tailwindcss'];
222
+ /**
223
+ * @version `^4.2.0`
224
+ * @group 0.重要配置
225
+ * @ignore
226
+ * @description uni-app x 的配置
227
+ */
228
+ uniAppX?: boolean;
222
229
  }
223
230
  interface UserDefinedOptions {
224
231
  /**
@@ -480,6 +487,7 @@ interface IJsHandlerOptions {
480
487
  babelParserOptions?: ParserOptions;
481
488
  ignoreTaggedTemplateExpressionIdentifiers?: (string | RegExp)[];
482
489
  ignoreCallExpressionIdentifiers?: (string | RegExp)[];
490
+ uniAppX?: boolean;
483
491
  }
484
492
  interface IArbitraryValues {
485
493
  /**