weapp-tailwindcss 4.11.0-alpha.4 → 4.11.0-alpha.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 (49) hide show
  1. package/dist/{chunk-GCZ7ZE7V.js → chunk-4BHL5BDO.js} +31 -31
  2. package/dist/{chunk-N3RT3VZH.js → chunk-DO6MQ3YF.js} +364 -74
  3. package/dist/{chunk-JKK5KZCN.js → chunk-KWG7VWW5.js} +3 -3
  4. package/dist/{chunk-TDHY27WS.mjs → chunk-LYANBRNN.mjs} +1 -1
  5. package/dist/{chunk-3V52XTPJ.mjs → chunk-OMARW5NC.mjs} +50 -0
  6. package/dist/{chunk-FI75TLOQ.js → chunk-QK6VNNNL.js} +51 -1
  7. package/dist/{chunk-NYZTRTBM.mjs → chunk-RQLIVYJZ.mjs} +331 -41
  8. package/dist/{chunk-ZPGT5C7G.mjs → chunk-TSRWDW6S.mjs} +1 -1
  9. package/dist/{chunk-JOT24YET.mjs → chunk-VMKFA54Q.mjs} +10 -4
  10. package/dist/{chunk-VHUV7ZDB.js → chunk-VO5STL3U.js} +6 -6
  11. package/dist/{chunk-VO2ZPNCW.js → chunk-WPH7LL5V.js} +23 -17
  12. package/dist/{chunk-6R2OVCLW.mjs → chunk-ZMQZ667Q.mjs} +3 -3
  13. package/dist/cli.js +2 -1
  14. package/dist/cli.mjs +2 -1
  15. package/dist/core.d.mts +1 -1
  16. package/dist/core.d.ts +1 -1
  17. package/dist/core.js +7 -7
  18. package/dist/core.mjs +2 -2
  19. package/dist/defaults.d.mts +1 -1
  20. package/dist/defaults.d.ts +1 -1
  21. package/dist/gulp.d.mts +1 -1
  22. package/dist/gulp.d.ts +1 -1
  23. package/dist/gulp.js +4 -4
  24. package/dist/gulp.mjs +3 -3
  25. package/dist/{index-BMwzhITq.d.mts → index-D8E0GGqB.d.mts} +28 -2
  26. package/dist/{index-BMwzhITq.d.ts → index-D8E0GGqB.d.ts} +28 -2
  27. package/dist/index.d.mts +1 -1
  28. package/dist/index.d.ts +1 -1
  29. package/dist/index.js +7 -7
  30. package/dist/index.mjs +6 -6
  31. package/dist/presets.d.mts +36 -1
  32. package/dist/presets.d.ts +36 -1
  33. package/dist/presets.js +14 -5
  34. package/dist/presets.mjs +12 -3
  35. package/dist/types.d.mts +2 -2
  36. package/dist/types.d.ts +2 -2
  37. package/dist/vite.d.mts +1 -1
  38. package/dist/vite.d.ts +1 -1
  39. package/dist/vite.js +4 -4
  40. package/dist/vite.mjs +3 -3
  41. package/dist/webpack.d.mts +1 -1
  42. package/dist/webpack.d.ts +1 -1
  43. package/dist/webpack.js +5 -5
  44. package/dist/webpack.mjs +4 -4
  45. package/dist/webpack4.d.mts +1 -1
  46. package/dist/webpack4.d.ts +1 -1
  47. package/dist/webpack4.js +26 -26
  48. package/dist/webpack4.mjs +3 -3
  49. package/package.json +2 -1
@@ -23,13 +23,18 @@ var _chunkOF6MFURRjs = require('./chunk-OF6MFURR.js');
23
23
 
24
24
 
25
25
 
26
- var _chunkVO2ZPNCWjs = require('./chunk-VO2ZPNCW.js');
27
26
 
28
27
 
29
28
 
29
+ var _chunkWPH7LL5Vjs = require('./chunk-WPH7LL5V.js');
30
30
 
31
31
 
32
- var _chunkFI75TLOQjs = require('./chunk-FI75TLOQ.js');
32
+
33
+
34
+
35
+
36
+
37
+ var _chunkQK6VNNNLjs = require('./chunk-QK6VNNNL.js');
33
38
 
34
39
 
35
40
  var _chunkDYLQ6UOIjs = require('./chunk-DYLQ6UOI.js');
@@ -38,7 +43,7 @@ var _chunkDYLQ6UOIjs = require('./chunk-DYLQ6UOI.js');
38
43
  var _chunkCRDOWYG4js = require('./chunk-CRDOWYG4.js');
39
44
 
40
45
  // src/bundlers/vite/index.ts
41
- var _fs = require('fs');
46
+ var _fs = require('fs'); var _fs2 = _interopRequireDefault(_fs);
42
47
  var _path = require('path'); var _path2 = _interopRequireDefault(_path);
43
48
  var _process = require('process'); var _process2 = _interopRequireDefault(_process);
44
49
  var _htmltransform = require('@weapp-tailwindcss/postcss/html-transform'); var _htmltransform2 = _interopRequireDefault(_htmltransform);
@@ -47,6 +52,185 @@ var _htmltransform = require('@weapp-tailwindcss/postcss/html-transform'); var _
47
52
  var _compilerdom = require('@vue/compiler-dom');
48
53
  var _compilersfc = require('@vue/compiler-sfc');
49
54
  var _magicstring = require('magic-string'); var _magicstring2 = _interopRequireDefault(_magicstring);
55
+
56
+ // src/uni-app-x/component-local-style.ts
57
+ var _extractors = require('@weapp-tailwindcss/shared/extractors');
58
+
59
+ var EXPRESSION_WRAPPER_PREFIX = "(\n";
60
+ var EXPRESSION_WRAPPER_SUFFIX = "\n)";
61
+ var COMPONENT_RE = /(?:^|[/\\])components(?:[/\\].+)?\.(?:uvue|nvue)$/;
62
+ function createStableHash(input) {
63
+ let hash = 2166136261;
64
+ for (let i = 0; i < input.length; i++) {
65
+ hash ^= input.charCodeAt(i);
66
+ hash = Math.imul(hash, 16777619);
67
+ }
68
+ return (hash >>> 0).toString(36);
69
+ }
70
+ function extractLiteralValue(path6) {
71
+ const allowDoubleQuotes = path6.isTemplateElement();
72
+ if (path6.isStringLiteral()) {
73
+ return {
74
+ allowDoubleQuotes,
75
+ literal: path6.node.value,
76
+ offset: 1
77
+ };
78
+ }
79
+ return {
80
+ allowDoubleQuotes,
81
+ literal: path6.node.value.raw,
82
+ offset: 0
83
+ };
84
+ }
85
+ function createAlias(fileId, utility, index) {
86
+ return `wtu-${createStableHash(`${fileId}:${utility}`)}-${index.toString(36)}`;
87
+ }
88
+ function isRuntimeCandidate(candidate, runtimeSet) {
89
+ if (!runtimeSet || runtimeSet.size === 0) {
90
+ return false;
91
+ }
92
+ return runtimeSet.has(candidate) || runtimeSet.has(_chunkWPH7LL5Vjs.replaceWxml.call(void 0, candidate));
93
+ }
94
+ function shouldEnableComponentLocalStyle(id) {
95
+ return COMPONENT_RE.test(id);
96
+ }
97
+ var UniAppXComponentLocalStyleCollector = class {
98
+ constructor(fileId, runtimeSet) {
99
+ this.fileId = fileId;
100
+ this.runtimeSet = runtimeSet;
101
+ this.aliasByUtility = /* @__PURE__ */ new Map();
102
+ this.aliasByLookup = /* @__PURE__ */ new Map();
103
+ }
104
+ ensureAlias(utility) {
105
+ const cached = this.aliasByUtility.get(utility);
106
+ if (cached) {
107
+ return cached;
108
+ }
109
+ const alias = createAlias(this.fileId, utility, this.aliasByUtility.size);
110
+ this.aliasByUtility.set(utility, alias);
111
+ this.aliasByLookup.set(utility, alias);
112
+ this.aliasByLookup.set(_chunkWPH7LL5Vjs.replaceWxml.call(void 0, utility), alias);
113
+ return alias;
114
+ }
115
+ rewriteLiteral(literal, shouldInclude) {
116
+ const candidates = _extractors.splitCode.call(void 0, literal);
117
+ if (candidates.length === 0) {
118
+ return literal;
119
+ }
120
+ let rewritten = literal;
121
+ for (const candidate of candidates) {
122
+ if (!shouldInclude(candidate)) {
123
+ continue;
124
+ }
125
+ rewritten = rewritten.replace(candidate, this.ensureAlias(candidate));
126
+ }
127
+ return rewritten;
128
+ }
129
+ collectAndRewriteStaticClass(literal) {
130
+ return this.rewriteLiteral(literal, (candidate) => isRuntimeCandidate(candidate, this.runtimeSet));
131
+ }
132
+ collectRuntimeClasses(rawSource, options = {}) {
133
+ const wrapped = options.wrapExpression ? `${EXPRESSION_WRAPPER_PREFIX}${rawSource}${EXPRESSION_WRAPPER_SUFFIX}` : rawSource;
134
+ try {
135
+ const ast = _chunkWPH7LL5Vjs.babelParse.call(void 0, wrapped, {
136
+ plugins: ["typescript"],
137
+ sourceType: options.wrapExpression ? "module" : "unambiguous"
138
+ });
139
+ const analysis = _chunkWPH7LL5Vjs.analyzeSource.call(void 0, ast, {}, void 0, false);
140
+ for (const path6 of analysis.targetPaths) {
141
+ const { literal, allowDoubleQuotes } = extractLiteralValue(path6);
142
+ const candidates = _extractors.splitCode.call(void 0, literal, allowDoubleQuotes);
143
+ const classContext = options.wrapExpression || _chunkWPH7LL5Vjs.isClassContextLiteralPath.call(void 0, path6);
144
+ for (const candidate of candidates) {
145
+ if (!candidate || !classContext && !isRuntimeCandidate(candidate, this.runtimeSet)) {
146
+ continue;
147
+ }
148
+ if (isRuntimeCandidate(candidate, this.runtimeSet)) {
149
+ this.ensureAlias(candidate);
150
+ }
151
+ }
152
+ }
153
+ } catch (e) {
154
+ }
155
+ }
156
+ rewriteTransformedCode(rawSource, options = {}) {
157
+ if (this.aliasByLookup.size === 0) {
158
+ return rawSource;
159
+ }
160
+ const wrapped = options.wrapExpression ? `${EXPRESSION_WRAPPER_PREFIX}${rawSource}${EXPRESSION_WRAPPER_SUFFIX}` : rawSource;
161
+ try {
162
+ const ast = _chunkWPH7LL5Vjs.babelParse.call(void 0, wrapped, {
163
+ plugins: ["typescript"],
164
+ sourceType: options.wrapExpression ? "module" : "unambiguous"
165
+ });
166
+ const analysis = _chunkWPH7LL5Vjs.analyzeSource.call(void 0, ast, {}, void 0, false);
167
+ if (analysis.targetPaths.length === 0) {
168
+ return rawSource;
169
+ }
170
+ const updater = new (0, _chunkWPH7LL5Vjs.JsTokenUpdater)();
171
+ for (const path6 of analysis.targetPaths) {
172
+ const { literal, allowDoubleQuotes, offset } = extractLiteralValue(path6);
173
+ const candidates = _extractors.splitCode.call(void 0, literal, allowDoubleQuotes);
174
+ if (candidates.length === 0) {
175
+ continue;
176
+ }
177
+ let rewritten = literal;
178
+ let mutated = false;
179
+ for (const candidate of candidates) {
180
+ const alias = this.aliasByLookup.get(candidate);
181
+ if (!alias) {
182
+ continue;
183
+ }
184
+ const replaced = rewritten.replace(candidate, alias);
185
+ if (replaced !== rewritten) {
186
+ rewritten = replaced;
187
+ mutated = true;
188
+ }
189
+ }
190
+ if (!mutated || typeof path6.node.start !== "number" || typeof path6.node.end !== "number") {
191
+ continue;
192
+ }
193
+ updater.addToken({
194
+ start: path6.node.start + offset,
195
+ end: path6.node.end - offset,
196
+ value: rewritten,
197
+ path: path6
198
+ });
199
+ }
200
+ if (updater.length === 0) {
201
+ return rawSource;
202
+ }
203
+ const ms = new (0, _magicstring2.default)(wrapped);
204
+ updater.updateMagicString(ms);
205
+ if (options.wrapExpression) {
206
+ ms.remove(0, EXPRESSION_WRAPPER_PREFIX.length);
207
+ ms.remove(wrapped.length - EXPRESSION_WRAPPER_SUFFIX.length, wrapped.length);
208
+ }
209
+ return ms.toString();
210
+ } catch (e2) {
211
+ return rawSource;
212
+ }
213
+ }
214
+ hasStyles() {
215
+ return this.aliasByUtility.size > 0;
216
+ }
217
+ toStyleBlock() {
218
+ if (!this.hasStyles()) {
219
+ return "";
220
+ }
221
+ const lines = ["<style scoped>"];
222
+ for (const [utility, alias] of this.aliasByUtility) {
223
+ lines.push(`.${alias} {`);
224
+ lines.push(` @apply ${utility};`);
225
+ lines.push("}");
226
+ }
227
+ lines.push("</style>");
228
+ return `${lines.join("\n")}
229
+ `;
230
+ }
231
+ };
232
+
233
+ // src/uni-app-x/transform.ts
50
234
  function traverse2(node, visitor) {
51
235
  visitor(node);
52
236
  if (Array.isArray(node.children)) {
@@ -64,7 +248,17 @@ function updateStaticAttribute(ms, prop) {
64
248
  const start = prop.value.loc.start.offset + 1;
65
249
  const end = prop.value.loc.end.offset - 1;
66
250
  if (start < end) {
67
- ms.update(start, end, _chunkVO2ZPNCWjs.replaceWxml.call(void 0, prop.value.content));
251
+ ms.update(start, end, _chunkWPH7LL5Vjs.replaceWxml.call(void 0, prop.value.content));
252
+ }
253
+ }
254
+ function updateStaticAttributeWithLocalStyle(ms, prop, collector) {
255
+ if (!prop.value) {
256
+ return;
257
+ }
258
+ const start = prop.value.loc.start.offset + 1;
259
+ const end = prop.value.loc.end.offset - 1;
260
+ if (start < end) {
261
+ ms.update(start, end, collector.collectAndRewriteStaticClass(prop.value.content));
68
262
  }
69
263
  }
70
264
  function updateDirectiveExpression(ms, prop, jsHandler, runtimeSet) {
@@ -76,17 +270,36 @@ function updateDirectiveExpression(ms, prop, jsHandler, runtimeSet) {
76
270
  if (start >= end) {
77
271
  return;
78
272
  }
79
- const generated = _chunkVO2ZPNCWjs.generateCode.call(void 0, prop.exp.content, {
273
+ const generated = _chunkWPH7LL5Vjs.generateCode.call(void 0, prop.exp.content, {
80
274
  jsHandler,
81
275
  runtimeSet,
82
276
  wrapExpression: true
83
277
  });
84
278
  ms.update(start, end, generated);
85
279
  }
280
+ function updateDirectiveExpressionWithLocalStyle(ms, prop, jsHandler, collector, runtimeSet) {
281
+ if (_optionalChain([prop, 'access', _3 => _3.exp, 'optionalAccess', _4 => _4.type]) !== _compilerdom.NodeTypes.SIMPLE_EXPRESSION) {
282
+ return;
283
+ }
284
+ const start = prop.exp.loc.start.offset;
285
+ const end = prop.exp.loc.end.offset;
286
+ if (start >= end) {
287
+ return;
288
+ }
289
+ collector.collectRuntimeClasses(prop.exp.content, {
290
+ wrapExpression: true
291
+ });
292
+ const generated = _chunkWPH7LL5Vjs.generateCode.call(void 0, prop.exp.content, {
293
+ jsHandler,
294
+ runtimeSet,
295
+ wrapExpression: true
296
+ });
297
+ ms.update(start, end, collector.rewriteTransformedCode(generated, { wrapExpression: true }));
298
+ }
86
299
  function shouldHandleAttribute(tag, attrName, disabledDefaultTemplateHandler, matchCustomAttribute) {
87
300
  const lowerName = attrName.toLowerCase();
88
301
  const shouldHandleDefault = !disabledDefaultTemplateHandler && lowerName === "class";
89
- const shouldHandleCustom = _nullishCoalesce(_optionalChain([matchCustomAttribute, 'optionalCall', _3 => _3(tag, attrName)]), () => ( false));
302
+ const shouldHandleCustom = _nullishCoalesce(_optionalChain([matchCustomAttribute, 'optionalCall', _5 => _5(tag, attrName)]), () => ( false));
90
303
  return {
91
304
  shouldHandleDefault,
92
305
  shouldHandleCustom,
@@ -106,11 +319,12 @@ function transformUVue(code, id, jsHandler, runtimeSet, options = {}) {
106
319
  return;
107
320
  }
108
321
  const { customAttributesEntities, disabledDefaultTemplateHandler = false } = options;
109
- const matchCustomAttribute = _chunkVO2ZPNCWjs.createAttributeMatcher.call(void 0, customAttributesEntities);
322
+ const matchCustomAttribute = _chunkWPH7LL5Vjs.createAttributeMatcher.call(void 0, customAttributesEntities);
110
323
  const ms = new (0, _magicstring2.default)(code);
111
324
  const { descriptor, errors } = _compilersfc.parse.call(void 0, code);
325
+ const localStyleCollector = options.enableComponentLocalStyle && shouldEnableComponentLocalStyle(id) ? new UniAppXComponentLocalStyleCollector(id, runtimeSet) : void 0;
112
326
  if (errors.length === 0) {
113
- if (_optionalChain([descriptor, 'access', _4 => _4.template, 'optionalAccess', _5 => _5.ast])) {
327
+ if (_optionalChain([descriptor, 'access', _6 => _6.template, 'optionalAccess', _7 => _7.ast])) {
114
328
  traverse2(descriptor.template.ast, (node) => {
115
329
  if (node.type !== _compilerdom.NodeTypes.ELEMENT) {
116
330
  return;
@@ -127,11 +341,15 @@ function transformUVue(code, id, jsHandler, runtimeSet, options = {}) {
127
341
  if (!shouldHandle) {
128
342
  continue;
129
343
  }
130
- updateStaticAttribute(ms, prop);
344
+ if (shouldHandleDefault && localStyleCollector) {
345
+ updateStaticAttributeWithLocalStyle(ms, prop, localStyleCollector);
346
+ } else {
347
+ updateStaticAttribute(ms, prop);
348
+ }
131
349
  if (shouldHandleDefault) {
132
350
  continue;
133
351
  }
134
- } else if (prop.type === _compilerdom.NodeTypes.DIRECTIVE && prop.name === "bind" && _optionalChain([prop, 'access', _6 => _6.arg, 'optionalAccess', _7 => _7.type]) === _compilerdom.NodeTypes.SIMPLE_EXPRESSION && prop.arg.isStatic) {
352
+ } else if (prop.type === _compilerdom.NodeTypes.DIRECTIVE && prop.name === "bind" && _optionalChain([prop, 'access', _8 => _8.arg, 'optionalAccess', _9 => _9.type]) === _compilerdom.NodeTypes.SIMPLE_EXPRESSION && prop.arg.isStatic) {
135
353
  const attrName = prop.arg.content;
136
354
  const { shouldHandle } = shouldHandleAttribute(
137
355
  tag,
@@ -142,18 +360,36 @@ function transformUVue(code, id, jsHandler, runtimeSet, options = {}) {
142
360
  if (!shouldHandle) {
143
361
  continue;
144
362
  }
145
- updateDirectiveExpression(ms, prop, jsHandler, runtimeSet);
363
+ if (attrName.toLowerCase() === "class" && localStyleCollector) {
364
+ updateDirectiveExpressionWithLocalStyle(ms, prop, jsHandler, localStyleCollector, runtimeSet);
365
+ } else {
366
+ updateDirectiveExpression(ms, prop, jsHandler, runtimeSet);
367
+ }
146
368
  }
147
369
  }
148
370
  });
149
371
  }
150
372
  if (descriptor.script) {
373
+ _optionalChain([localStyleCollector, 'optionalAccess', _10 => _10.collectRuntimeClasses, 'call', _11 => _11(descriptor.script.content)]);
151
374
  const { code: code2 } = jsHandler(descriptor.script.content, _nullishCoalesce(runtimeSet, () => ( /* @__PURE__ */ new Set())), defaultCreateJsHandlerOptions);
152
- ms.update(descriptor.script.loc.start.offset, descriptor.script.loc.end.offset, code2);
375
+ ms.update(
376
+ descriptor.script.loc.start.offset,
377
+ descriptor.script.loc.end.offset,
378
+ localStyleCollector ? localStyleCollector.rewriteTransformedCode(code2) : code2
379
+ );
153
380
  }
154
381
  if (descriptor.scriptSetup) {
382
+ _optionalChain([localStyleCollector, 'optionalAccess', _12 => _12.collectRuntimeClasses, 'call', _13 => _13(descriptor.scriptSetup.content)]);
155
383
  const { code: code2 } = jsHandler(descriptor.scriptSetup.content, _nullishCoalesce(runtimeSet, () => ( /* @__PURE__ */ new Set())), defaultCreateJsHandlerOptions);
156
- ms.update(descriptor.scriptSetup.loc.start.offset, descriptor.scriptSetup.loc.end.offset, code2);
384
+ ms.update(
385
+ descriptor.scriptSetup.loc.start.offset,
386
+ descriptor.scriptSetup.loc.end.offset,
387
+ localStyleCollector ? localStyleCollector.rewriteTransformedCode(code2) : code2
388
+ );
389
+ }
390
+ if (_optionalChain([localStyleCollector, 'optionalAccess', _14 => _14.hasStyles, 'call', _15 => _15()])) {
391
+ ms.append(`
392
+ ${localStyleCollector.toStyleBlock()}`);
157
393
  }
158
394
  }
159
395
  return {
@@ -231,6 +467,33 @@ async function formatPostcssSourceMap(rawMap, file) {
231
467
  };
232
468
  }
233
469
 
470
+ // src/uni-app-x/style-isolation.ts
471
+
472
+
473
+ var _commentjson = require('comment-json');
474
+ var manifestCache = /* @__PURE__ */ new Map();
475
+ function resolveUniAppXStyleIsolationEnabled(root) {
476
+ if (!root) {
477
+ return false;
478
+ }
479
+ const normalizedRoot = _path2.default.resolve(root);
480
+ const cached = manifestCache.get(normalizedRoot);
481
+ if (cached !== void 0) {
482
+ return cached;
483
+ }
484
+ const manifestPath = _path2.default.join(normalizedRoot, "manifest.json");
485
+ let enabled = false;
486
+ try {
487
+ const raw = _fs2.default.readFileSync(manifestPath, "utf8");
488
+ const manifest = _commentjson.parse.call(void 0, raw);
489
+ enabled = `${_nullishCoalesce(_optionalChain([manifest, 'access', _16 => _16["uni-app-x"], 'optionalAccess', _17 => _17.styleIsolationVersion]), () => ( ""))}` === "2";
490
+ } catch (e3) {
491
+ enabled = false;
492
+ }
493
+ manifestCache.set(normalizedRoot, enabled);
494
+ return enabled;
495
+ }
496
+
234
497
  // src/uni-app-x/vite.ts
235
498
  var preprocessorLangs = /* @__PURE__ */ new Set(["scss", "sass", "less", "styl", "stylus"]);
236
499
  var INLINE_LANG_RE = /lang\.([a-z]+)/i;
@@ -238,7 +501,7 @@ var PREPROCESSOR_EXT_RE = /\.(?:scss|sass|less|styl|stylus)(?:\?|$)/i;
238
501
  var UVUE_NVUE_QUERY_RE = /\.(?:uvue|nvue)(?:\?.*)?$/;
239
502
  var UVUE_NVUE_RE2 = /\.(?:uvue|nvue)$/;
240
503
  function isPreprocessorRequest(id, lang) {
241
- const normalizedLang = _optionalChain([lang, 'optionalAccess', _8 => _8.toLowerCase, 'call', _9 => _9()]);
504
+ const normalizedLang = _optionalChain([lang, 'optionalAccess', _18 => _18.toLowerCase, 'call', _19 => _19()]);
242
505
  if (normalizedLang && preprocessorLangs.has(normalizedLang)) {
243
506
  return true;
244
507
  }
@@ -259,10 +522,29 @@ function createUniAppXPlugins(options) {
259
522
  styleHandler,
260
523
  jsHandler,
261
524
  ensureRuntimeClassSet,
262
- getResolvedConfig
525
+ getResolvedConfig,
526
+ uniAppX
263
527
  } = options;
528
+ const resolvedUniAppXOptions = _chunkQK6VNNNLjs.resolveUniAppXOptions.call(void 0, uniAppX);
264
529
  const isIosPlatform = _nullishCoalesce(providedIosPlatform, () => ( _chunkDYLQ6UOIjs.resolveUniUtsPlatform.call(void 0, ).isAppIos));
265
530
  const cssHandlerOptionsCache = /* @__PURE__ */ new Map();
531
+ let componentLocalStyleEnabled;
532
+ function shouldEnableComponentLocalStyle2() {
533
+ if (!resolvedUniAppXOptions.componentLocalStyles.enabled) {
534
+ componentLocalStyleEnabled = false;
535
+ return false;
536
+ }
537
+ if (!resolvedUniAppXOptions.componentLocalStyles.onlyWhenStyleIsolationVersion2) {
538
+ componentLocalStyleEnabled = true;
539
+ return true;
540
+ }
541
+ if (componentLocalStyleEnabled !== void 0) {
542
+ return componentLocalStyleEnabled;
543
+ }
544
+ const root = _optionalChain([getResolvedConfig, 'call', _20 => _20(), 'optionalAccess', _21 => _21.root]);
545
+ componentLocalStyleEnabled = resolveUniAppXStyleIsolationEnabled(root);
546
+ return componentLocalStyleEnabled;
547
+ }
266
548
  async function transformStyle(code, id, query) {
267
549
  const parsed = _nullishCoalesce(query, () => ( parseVueRequest(id).query));
268
550
  if (isCSSRequest(id) || parsed.vue && parsed.type === "style") {
@@ -330,23 +612,29 @@ function createUniAppXPlugins(options) {
330
612
  return;
331
613
  }
332
614
  const resolvedConfig = getResolvedConfig();
333
- const isServeCommand = _optionalChain([resolvedConfig, 'optionalAccess', _10 => _10.command]) === "serve";
334
- const isWatchBuild = _optionalChain([resolvedConfig, 'optionalAccess', _11 => _11.command]) === "build" && !!_optionalChain([resolvedConfig, 'access', _12 => _12.build, 'optionalAccess', _13 => _13.watch]);
335
- const isNonWatchBuild = _optionalChain([resolvedConfig, 'optionalAccess', _14 => _14.command]) === "build" && !_optionalChain([resolvedConfig, 'access', _15 => _15.build, 'optionalAccess', _16 => _16.watch]);
615
+ const isServeCommand = _optionalChain([resolvedConfig, 'optionalAccess', _22 => _22.command]) === "serve";
616
+ const isWatchBuild = _optionalChain([resolvedConfig, 'optionalAccess', _23 => _23.command]) === "build" && !!_optionalChain([resolvedConfig, 'access', _24 => _24.build, 'optionalAccess', _25 => _25.watch]);
617
+ const isNonWatchBuild = _optionalChain([resolvedConfig, 'optionalAccess', _26 => _26.command]) === "build" && !_optionalChain([resolvedConfig, 'access', _27 => _27.build, 'optionalAccess', _28 => _28.watch]);
336
618
  const shouldForceRefresh = isServeCommand || isWatchBuild || isNonWatchBuild;
337
619
  const currentRuntimeSet = shouldForceRefresh ? await ensureRuntimeClassSet(true) : await ensureRuntimeClassSet();
338
620
  const extraOptions = customAttributesEntities.length > 0 || disabledDefaultTemplateHandler ? {
339
621
  customAttributesEntities,
340
- disabledDefaultTemplateHandler
622
+ disabledDefaultTemplateHandler,
623
+ enableComponentLocalStyle: shouldEnableComponentLocalStyle2()
341
624
  } : void 0;
342
625
  if (extraOptions) {
343
626
  return transformUVue(code, id, jsHandler, currentRuntimeSet, extraOptions);
344
627
  }
628
+ if (shouldEnableComponentLocalStyle2()) {
629
+ return transformUVue(code, id, jsHandler, currentRuntimeSet, {
630
+ enableComponentLocalStyle: true
631
+ });
632
+ }
345
633
  return transformUVue(code, id, jsHandler, currentRuntimeSet);
346
634
  },
347
635
  async handleHotUpdate(ctx) {
348
636
  const resolvedConfig = getResolvedConfig();
349
- if (_optionalChain([resolvedConfig, 'optionalAccess', _17 => _17.command]) !== "serve") {
637
+ if (_optionalChain([resolvedConfig, 'optionalAccess', _29 => _29.command]) !== "serve") {
350
638
  return;
351
639
  }
352
640
  if (!UVUE_NVUE_RE2.test(ctx.file)) {
@@ -356,7 +644,7 @@ function createUniAppXPlugins(options) {
356
644
  },
357
645
  async watchChange(id) {
358
646
  const resolvedConfig = getResolvedConfig();
359
- if (_optionalChain([resolvedConfig, 'optionalAccess', _18 => _18.command]) !== "build" || !_optionalChain([resolvedConfig, 'access', _19 => _19.build, 'optionalAccess', _20 => _20.watch])) {
647
+ if (_optionalChain([resolvedConfig, 'optionalAccess', _30 => _30.command]) !== "build" || !_optionalChain([resolvedConfig, 'access', _31 => _31.build, 'optionalAccess', _32 => _32.watch])) {
360
648
  return;
361
649
  }
362
650
  if (!UVUE_NVUE_QUERY_RE.test(id)) {
@@ -423,7 +711,7 @@ function createUniAppXAssetTask(file, originalSource, outDir, options) {
423
711
 
424
712
 
425
713
  var _logger = require('@weapp-tailwindcss/logger');
426
- var _extractors = require('@weapp-tailwindcss/shared/extractors');
714
+
427
715
 
428
716
  // src/bundlers/vite/bundle-entries.ts
429
717
  var _buffer = require('buffer');
@@ -488,7 +776,7 @@ function applyLinkedResults(linked, entries, onLinkedUpdate, onApplied) {
488
776
  } else {
489
777
  entry.output.source = code;
490
778
  }
491
- _optionalChain([onApplied, 'optionalCall', _21 => _21(entry, code)]);
779
+ _optionalChain([onApplied, 'optionalCall', _33 => _33(entry, code)]);
492
780
  onLinkedUpdate(entry.fileName, previous, code);
493
781
  }
494
782
  }
@@ -524,29 +812,29 @@ function createHtmlRuntimeAffectingSignature(source) {
524
812
  parser.write(source);
525
813
  parser.end();
526
814
  return parts.join("\n");
527
- } catch (e) {
815
+ } catch (e4) {
528
816
  return source;
529
817
  }
530
818
  }
531
819
  function createJsRuntimeAffectingSignature(source) {
532
820
  try {
533
- const ast = _chunkVO2ZPNCWjs.babelParse.call(void 0, source, {
821
+ const ast = _chunkWPH7LL5Vjs.babelParse.call(void 0, source, {
534
822
  cache: true,
535
823
  cacheKey: "vite-runtime-affecting:unambiguous",
536
824
  plugins: ["jsx", "typescript"],
537
825
  sourceType: "unambiguous"
538
826
  });
539
827
  const parts = [];
540
- _chunkVO2ZPNCWjs.traverse.call(void 0, ast, {
828
+ _chunkWPH7LL5Vjs.traverse.call(void 0, ast, {
541
829
  noScope: true,
542
- StringLiteral(path5) {
543
- parts.push(`s:${path5.node.value}`);
830
+ StringLiteral(path6) {
831
+ parts.push(`s:${path6.node.value}`);
544
832
  },
545
- TemplateElement(path5) {
546
- parts.push(`t:${path5.node.value.raw}`);
833
+ TemplateElement(path6) {
834
+ parts.push(`t:${path6.node.value.raw}`);
547
835
  },
548
- JSXText(path5) {
549
- const value = path5.node.value.trim();
836
+ JSXText(path6) {
837
+ const value = path6.node.value.trim();
550
838
  if (value.length > 0) {
551
839
  parts.push(`x:${value}`);
552
840
  }
@@ -555,13 +843,13 @@ function createJsRuntimeAffectingSignature(source) {
555
843
  const comments = ast.comments;
556
844
  if (Array.isArray(comments)) {
557
845
  for (const comment of comments) {
558
- if (typeof _optionalChain([comment, 'optionalAccess', _22 => _22.value]) === "string" && comment.value.length > 0) {
846
+ if (typeof _optionalChain([comment, 'optionalAccess', _34 => _34.value]) === "string" && comment.value.length > 0) {
559
847
  parts.push(`c:${comment.value}`);
560
848
  }
561
849
  }
562
850
  }
563
851
  return parts.join("\n");
564
- } catch (e2) {
852
+ } catch (e5) {
565
853
  return source;
566
854
  }
567
855
  }
@@ -750,13 +1038,13 @@ function shouldSkipViteJsTransform(rawSource, options) {
750
1038
  if (!rawSource) {
751
1039
  return true;
752
1040
  }
753
- if (_optionalChain([options, 'optionalAccess', _23 => _23.alwaysEscape])) {
1041
+ if (_optionalChain([options, 'optionalAccess', _35 => _35.alwaysEscape])) {
754
1042
  return false;
755
1043
  }
756
- if (_optionalChain([options, 'optionalAccess', _24 => _24.moduleSpecifierReplacements]) && Object.keys(options.moduleSpecifierReplacements).length > 0) {
1044
+ if (_optionalChain([options, 'optionalAccess', _36 => _36.moduleSpecifierReplacements]) && Object.keys(options.moduleSpecifierReplacements).length > 0) {
757
1045
  return false;
758
1046
  }
759
- if (_optionalChain([options, 'optionalAccess', _25 => _25.wrapExpression])) {
1047
+ if (_optionalChain([options, 'optionalAccess', _37 => _37.wrapExpression])) {
760
1048
  return false;
761
1049
  }
762
1050
  if (DEPENDENCY_HINT_RE.test(rawSource)) {
@@ -934,10 +1222,10 @@ function createGenerateBundleHook(context) {
934
1222
  const debugCssDiff = _process2.default.env.WEAPP_TW_VITE_DEBUG_CSS_DIFF === "1";
935
1223
  const resolvedConfig = getResolvedConfig();
936
1224
  const bundleFiles = Object.keys(bundle);
937
- const buildCommand = _optionalChain([resolvedConfig, 'optionalAccess', _26 => _26.command]) === "build";
1225
+ const buildCommand = _optionalChain([resolvedConfig, 'optionalAccess', _38 => _38.command]) === "build";
938
1226
  const useIncrementalMode = !buildCommand || hasOmittedKnownBundleFiles(bundleFiles, state.sourceHashByFile.keys());
939
- const rootDir = _optionalChain([resolvedConfig, 'optionalAccess', _27 => _27.root]) ? _path2.default.resolve(resolvedConfig.root) : _process2.default.cwd();
940
- const outDir = _optionalChain([resolvedConfig, 'optionalAccess', _28 => _28.build, 'optionalAccess', _29 => _29.outDir]) ? _path2.default.resolve(rootDir, resolvedConfig.build.outDir) : rootDir;
1227
+ const rootDir = _optionalChain([resolvedConfig, 'optionalAccess', _39 => _39.root]) ? _path2.default.resolve(resolvedConfig.root) : _process2.default.cwd();
1228
+ const outDir = _optionalChain([resolvedConfig, 'optionalAccess', _40 => _40.build, 'optionalAccess', _41 => _41.outDir]) ? _path2.default.resolve(rootDir, resolvedConfig.build.outDir) : rootDir;
941
1229
  const snapshot = buildBundleSnapshot(bundle, opts, outDir, state, disableDirtyOptimization || !useIncrementalMode);
942
1230
  const useBundleRuntimeClassSet = useIncrementalMode || runtimeState.twPatcher.majorVersion === 4;
943
1231
  const forceRuntimeRefreshBySource = useIncrementalMode && hasRuntimeAffectingSourceChanges(snapshot.runtimeAffectingChangedByType);
@@ -992,7 +1280,7 @@ function createGenerateBundleHook(context) {
992
1280
  );
993
1281
  }
994
1282
  debug3("get runtimeSet, class count: %d", runtime.size);
995
- const runtimeSignature = _nullishCoalesce(_chunkFI75TLOQjs.getRuntimeClassSetSignature.call(void 0, runtimeState.twPatcher), () => ( "runtime:missing"));
1283
+ const runtimeSignature = _nullishCoalesce(_chunkQK6VNNNLjs.getRuntimeClassSetSignature.call(void 0, runtimeState.twPatcher), () => ( "runtime:missing"));
996
1284
  const handleLinkedUpdate = (fileName, previous, next) => {
997
1285
  onUpdate(fileName, previous, next);
998
1286
  debug3("js linked handle: %s", fileName);
@@ -1016,7 +1304,7 @@ function createGenerateBundleHook(context) {
1016
1304
  tailwindcssMajorVersion: runtimeState.twPatcher.majorVersion,
1017
1305
  moduleGraph: moduleGraphOptions,
1018
1306
  babelParserOptions: {
1019
- ..._nullishCoalesce(_optionalChain([extra, 'optionalAccess', _30 => _30.babelParserOptions]), () => ( {})),
1307
+ ..._nullishCoalesce(_optionalChain([extra, 'optionalAccess', _42 => _42.babelParserOptions]), () => ( {})),
1020
1308
  sourceFilename: absoluteFilename
1021
1309
  }
1022
1310
  });
@@ -1319,7 +1607,7 @@ var _module = require('module');
1319
1607
 
1320
1608
 
1321
1609
  var _tailwindcsspatch = require('tailwindcss-patch');
1322
- var debug = _chunkVO2ZPNCWjs.createDebug.call(void 0, "[vite:runtime-set] ");
1610
+ var debug = _chunkWPH7LL5Vjs.createDebug.call(void 0, "[vite:runtime-set] ");
1323
1611
  var require2 = _module.createRequire.call(void 0, _chunkCRDOWYG4js.importMetaUrl);
1324
1612
  var EXTENSION_DOT_PREFIX_RE = /^\./;
1325
1613
  var VALIDATION_FILE_NAME = "runtime-candidates.html";
@@ -1337,23 +1625,23 @@ function isPostcssPluginImportTarget(value) {
1337
1625
  return value === "@tailwindcss/postcss" || value === "@tailwindcss/postcss7-compat" || value.includes("/postcss");
1338
1626
  }
1339
1627
  function resolveTailwindCssImportTarget(patcher) {
1340
- const tailwindOptions = _chunkFI75TLOQjs.resolveTailwindcssOptions.call(void 0, patcher.options);
1341
- const cssEntries = _optionalChain([tailwindOptions, 'optionalAccess', _31 => _31.v4, 'optionalAccess', _32 => _32.cssEntries, 'optionalAccess', _33 => _33.filter, 'call', _34 => _34((item) => typeof item === "string" && item.length > 0)]);
1628
+ const tailwindOptions = _chunkQK6VNNNLjs.resolveTailwindcssOptions.call(void 0, patcher.options);
1629
+ const cssEntries = _optionalChain([tailwindOptions, 'optionalAccess', _43 => _43.v4, 'optionalAccess', _44 => _44.cssEntries, 'optionalAccess', _45 => _45.filter, 'call', _46 => _46((item) => typeof item === "string" && item.length > 0)]);
1342
1630
  if (cssEntries && cssEntries.length > 0) {
1343
1631
  return createCssImportSource(cssEntries);
1344
1632
  }
1345
- const configuredPackageName = _optionalChain([tailwindOptions, 'optionalAccess', _35 => _35.packageName]);
1633
+ const configuredPackageName = _optionalChain([tailwindOptions, 'optionalAccess', _47 => _47.packageName]);
1346
1634
  if (typeof configuredPackageName === "string" && configuredPackageName.length > 0 && !isPostcssPluginImportTarget(configuredPackageName)) {
1347
1635
  return createCssImportSource([configuredPackageName]);
1348
1636
  }
1349
- const packageName = _optionalChain([patcher, 'access', _36 => _36.packageInfo, 'optionalAccess', _37 => _37.name]);
1637
+ const packageName = _optionalChain([patcher, 'access', _48 => _48.packageInfo, 'optionalAccess', _49 => _49.name]);
1350
1638
  if (typeof packageName === "string" && packageName.length > 0 && !isPostcssPluginImportTarget(packageName)) {
1351
1639
  return createCssImportSource([packageName]);
1352
1640
  }
1353
1641
  return createCssImportSource(["tailwindcss"]);
1354
1642
  }
1355
1643
  function getProjectRoot(patcher) {
1356
- return _nullishCoalesce(_optionalChain([patcher, 'access', _38 => _38.options, 'optionalAccess', _39 => _39.projectRoot]), () => ( _process2.default.cwd()));
1644
+ return _nullishCoalesce(_optionalChain([patcher, 'access', _50 => _50.options, 'optionalAccess', _51 => _51.projectRoot]), () => ( _process2.default.cwd()));
1357
1645
  }
1358
1646
  async function importTailwindNodeModule() {
1359
1647
  if (!tailwindNodeModulePromise) {
@@ -1361,7 +1649,7 @@ async function importTailwindNodeModule() {
1361
1649
  try {
1362
1650
  const resolved = require2.resolve("@tailwindcss/node");
1363
1651
  return await Promise.resolve().then(() => _interopRequireWildcard(require(resolved)));
1364
- } catch (e3) {
1652
+ } catch (e6) {
1365
1653
  const tailwindcssPatchEntry = require2.resolve("tailwindcss-patch");
1366
1654
  const resolved = require2.resolve("@tailwindcss/node", {
1367
1655
  paths: [_path2.default.dirname(tailwindcssPatchEntry)]
@@ -1380,16 +1668,16 @@ function resolveMaybeAbsolute(base, value) {
1380
1668
  }
1381
1669
  async function resolveTailwindCssSource(patcher) {
1382
1670
  const projectRoot = getProjectRoot(patcher);
1383
- const tailwindOptions = _chunkFI75TLOQjs.resolveTailwindcssOptions.call(void 0, patcher.options);
1384
- const configuredBase = resolveMaybeAbsolute(projectRoot, _optionalChain([tailwindOptions, 'optionalAccess', _40 => _40.v4, 'optionalAccess', _41 => _41.base]));
1385
- const configDir = _optionalChain([tailwindOptions, 'optionalAccess', _42 => _42.config]) ? _path2.default.dirname(tailwindOptions.config) : void 0;
1671
+ const tailwindOptions = _chunkQK6VNNNLjs.resolveTailwindcssOptions.call(void 0, patcher.options);
1672
+ const configuredBase = resolveMaybeAbsolute(projectRoot, _optionalChain([tailwindOptions, 'optionalAccess', _52 => _52.v4, 'optionalAccess', _53 => _53.base]));
1673
+ const configDir = _optionalChain([tailwindOptions, 'optionalAccess', _54 => _54.config]) ? _path2.default.dirname(tailwindOptions.config) : void 0;
1386
1674
  const sharedFallbacks = [
1387
1675
  configuredBase,
1388
1676
  projectRoot,
1389
- _optionalChain([tailwindOptions, 'optionalAccess', _43 => _43.cwd]),
1677
+ _optionalChain([tailwindOptions, 'optionalAccess', _55 => _55.cwd]),
1390
1678
  configDir
1391
1679
  ].filter((item) => typeof item === "string" && item.length > 0);
1392
- if (_optionalChain([tailwindOptions, 'optionalAccess', _44 => _44.v4, 'optionalAccess', _45 => _45.css])) {
1680
+ if (_optionalChain([tailwindOptions, 'optionalAccess', _56 => _56.v4, 'optionalAccess', _57 => _57.css])) {
1393
1681
  return {
1394
1682
  projectRoot,
1395
1683
  base: _nullishCoalesce(configuredBase, () => ( projectRoot)),
@@ -1397,7 +1685,7 @@ async function resolveTailwindCssSource(patcher) {
1397
1685
  css: tailwindOptions.v4.css
1398
1686
  };
1399
1687
  }
1400
- const cssEntries = _nullishCoalesce(_optionalChain([tailwindOptions, 'optionalAccess', _46 => _46.v4, 'optionalAccess', _47 => _47.cssEntries, 'optionalAccess', _48 => _48.filter, 'call', _49 => _49((item) => typeof item === "string" && item.length > 0)]), () => ( []));
1688
+ const cssEntries = _nullishCoalesce(_optionalChain([tailwindOptions, 'optionalAccess', _58 => _58.v4, 'optionalAccess', _59 => _59.cssEntries, 'optionalAccess', _60 => _60.filter, 'call', _61 => _61((item) => typeof item === "string" && item.length > 0)]), () => ( []));
1401
1689
  if (cssEntries.length > 0) {
1402
1690
  const resolvedEntries = cssEntries.map((entry) => _nullishCoalesce(resolveMaybeAbsolute(projectRoot, entry), () => ( entry)));
1403
1691
  const cssChunks = [];
@@ -1406,7 +1694,7 @@ async function resolveTailwindCssSource(patcher) {
1406
1694
  try {
1407
1695
  cssChunks.push(await _promises.readFile.call(void 0, entry, "utf8"));
1408
1696
  entryDirs.push(_path2.default.dirname(entry));
1409
- } catch (e4) {
1697
+ } catch (e7) {
1410
1698
  }
1411
1699
  }
1412
1700
  if (cssChunks.length > 0) {
@@ -1578,7 +1866,7 @@ function createBundleRuntimeClassSetManager(options = {}) {
1578
1866
  const matches = await extractRawCandidates(entry.source, resolveEntryExtension(entry));
1579
1867
  const candidates = /* @__PURE__ */ new Set();
1580
1868
  for (const match of matches) {
1581
- const candidate = _optionalChain([match, 'optionalAccess', _50 => _50.rawCandidate]);
1869
+ const candidate = _optionalChain([match, 'optionalAccess', _62 => _62.rawCandidate]);
1582
1870
  if (typeof candidate === "string" && candidate.length > 0) {
1583
1871
  candidates.add(candidate);
1584
1872
  }
@@ -1586,7 +1874,7 @@ function createBundleRuntimeClassSetManager(options = {}) {
1586
1874
  return candidates;
1587
1875
  }
1588
1876
  async function sync(patcher, snapshot) {
1589
- const nextSignature = _nullishCoalesce(_chunkFI75TLOQjs.getRuntimeClassSetSignature.call(void 0, patcher), () => ( "runtime:missing"));
1877
+ const nextSignature = _nullishCoalesce(_chunkQK6VNNNLjs.getRuntimeClassSetSignature.call(void 0, patcher), () => ( "runtime:missing"));
1590
1878
  const runtimeEntries = createRuntimeEntries(snapshot);
1591
1879
  const runtimeEntriesByFile = new Map(runtimeEntries.map((entry) => [entry.file, entry]));
1592
1880
  const currentRuntimeFiles = new Set(runtimeEntriesByFile.keys());
@@ -1690,7 +1978,7 @@ function createRewriteCssImportsPlugins(options) {
1690
1978
  const { appType, weappTailwindcssDirPosix: weappTailwindcssDirPosix2 } = options;
1691
1979
  return [
1692
1980
  {
1693
- name: `${_chunkVO2ZPNCWjs.vitePluginName}:rewrite-css-imports`,
1981
+ name: `${_chunkWPH7LL5Vjs.vitePluginName}:rewrite-css-imports`,
1694
1982
  enforce: "pre",
1695
1983
  resolveId: {
1696
1984
  order: "pre",
@@ -1732,7 +2020,7 @@ function createRewriteCssImportsPlugins(options) {
1732
2020
  }
1733
2021
 
1734
2022
  // src/bundlers/vite/index.ts
1735
- var debug2 = _chunkVO2ZPNCWjs.createDebug.call(void 0, );
2023
+ var debug2 = _chunkWPH7LL5Vjs.createDebug.call(void 0, );
1736
2024
  var weappTailwindcssPackageDir = _chunk7LKMJZD2js.resolvePackageDir.call(void 0, "weapp-tailwindcss");
1737
2025
  var weappTailwindcssDirPosix = slash(weappTailwindcssPackageDir);
1738
2026
  var PACKAGE_JSON_FILE = "package.json";
@@ -1751,11 +2039,11 @@ function resolveImplicitTailwindcssBasedirFromViteRoot(root) {
1751
2039
  }
1752
2040
  current = parent;
1753
2041
  }
1754
- const tailwindConfigPath = _chunkFI75TLOQjs.findTailwindConfig.call(void 0, searchRoots);
2042
+ const tailwindConfigPath = _chunkQK6VNNNLjs.findTailwindConfig.call(void 0, searchRoots);
1755
2043
  if (tailwindConfigPath) {
1756
2044
  return _path2.default.dirname(tailwindConfigPath);
1757
2045
  }
1758
- const packageRoot = _chunkFI75TLOQjs.findNearestPackageRoot.call(void 0, resolvedRoot);
2046
+ const packageRoot = _chunkQK6VNNNLjs.findNearestPackageRoot.call(void 0, resolvedRoot);
1759
2047
  if (packageRoot && _fs.existsSync.call(void 0, _path2.default.join(packageRoot, PACKAGE_JSON_FILE))) {
1760
2048
  return packageRoot;
1761
2049
  }
@@ -1764,7 +2052,7 @@ function resolveImplicitTailwindcssBasedirFromViteRoot(root) {
1764
2052
  function UnifiedViteWeappTailwindcssPlugin(options = {}) {
1765
2053
  const rewriteCssImportsSpecified = Object.hasOwn(options, "rewriteCssImports");
1766
2054
  const hasExplicitTailwindcssBasedir = typeof options.tailwindcssBasedir === "string" && options.tailwindcssBasedir.trim().length > 0;
1767
- const opts = _chunkVO2ZPNCWjs.getCompilerContext.call(void 0, options);
2055
+ const opts = _chunkWPH7LL5Vjs.getCompilerContext.call(void 0, options);
1768
2056
  const {
1769
2057
  disabled,
1770
2058
  customAttributes,
@@ -1778,6 +2066,7 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
1778
2066
  uniAppX,
1779
2067
  disabledDefaultTemplateHandler
1780
2068
  } = opts;
2069
+ const uniAppXEnabled = _chunkQK6VNNNLjs.isUniAppXEnabled.call(void 0, uniAppX);
1781
2070
  const disabledOptions = _chunk7LKMJZD2js.resolveDisabledOptions.call(void 0, disabled);
1782
2071
  const tailwindcssMajorVersion = _nullishCoalesce(initialTwPatcher.majorVersion, () => ( 0));
1783
2072
  const shouldRewriteCssImports = opts.rewriteCssImports !== false && !disabledOptions.rewriteCssImports && (rewriteCssImportsSpecified || tailwindcssMajorVersion >= 4);
@@ -1789,8 +2078,8 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
1789
2078
  if (disabledOptions.plugin) {
1790
2079
  return rewritePlugins.length ? rewritePlugins : void 0;
1791
2080
  }
1792
- const customAttributesEntities = _chunkVO2ZPNCWjs.toCustomAttributesEntities.call(void 0, customAttributes);
1793
- const patchRecorderState = _chunkVO2ZPNCWjs.setupPatchRecorder.call(void 0, initialTwPatcher, opts.tailwindcssBasedir, {
2081
+ const customAttributesEntities = _chunkWPH7LL5Vjs.toCustomAttributesEntities.call(void 0, customAttributes);
2082
+ const patchRecorderState = _chunkWPH7LL5Vjs.setupPatchRecorder.call(void 0, initialTwPatcher, opts.tailwindcssBasedir, {
1794
2083
  source: "runtime",
1795
2084
  cwd: _nullishCoalesce(opts.tailwindcssBasedir, () => ( _process2.default.cwd()))
1796
2085
  });
@@ -1807,11 +2096,11 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
1807
2096
  let runtimeRefreshOptionsKey;
1808
2097
  const bundleRuntimeClassSetManager = createBundleRuntimeClassSetManager();
1809
2098
  function resolveRuntimeRefreshOptions() {
1810
- const configPath = _optionalChain([_chunkFI75TLOQjs.resolveTailwindcssOptions.call(void 0, runtimeState.twPatcher.options), 'optionalAccess', _51 => _51.config]);
1811
- const signature = _chunkFI75TLOQjs.getRuntimeClassSetSignature.call(void 0, runtimeState.twPatcher);
2099
+ const configPath = _optionalChain([_chunkQK6VNNNLjs.resolveTailwindcssOptions.call(void 0, runtimeState.twPatcher.options), 'optionalAccess', _63 => _63.config]);
2100
+ const signature = _chunkQK6VNNNLjs.getRuntimeClassSetSignature.call(void 0, runtimeState.twPatcher);
1812
2101
  const optionsKey = JSON.stringify({
1813
2102
  appType,
1814
- uniAppX: Boolean(uniAppX),
2103
+ uniAppX: uniAppXEnabled,
1815
2104
  customAttributesEntities,
1816
2105
  disabledDefaultTemplateHandler,
1817
2106
  configPath,
@@ -1829,7 +2118,7 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
1829
2118
  async function refreshRuntimeState(force) {
1830
2119
  const invalidation = resolveRuntimeRefreshOptions();
1831
2120
  const shouldRefresh = force || invalidation.changed;
1832
- const refreshed = await _chunkVO2ZPNCWjs.refreshTailwindRuntimeState.call(void 0, runtimeState, {
2121
+ const refreshed = await _chunkWPH7LL5Vjs.refreshTailwindRuntimeState.call(void 0, runtimeState, {
1833
2122
  force: shouldRefresh,
1834
2123
  clearCache: force || invalidation.changed
1835
2124
  });
@@ -1850,7 +2139,7 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
1850
2139
  }
1851
2140
  if (forceRuntimeRefresh || !runtimeSetPromise) {
1852
2141
  const invalidation = resolveRuntimeRefreshOptions();
1853
- const task2 = _chunkVO2ZPNCWjs.collectRuntimeClassSet.call(void 0, runtimeState.twPatcher, {
2142
+ const task2 = _chunkWPH7LL5Vjs.collectRuntimeClassSet.call(void 0, runtimeState.twPatcher, {
1854
2143
  force: forceRuntimeRefresh || invalidation.changed,
1855
2144
  skipRefresh: forceRuntimeRefresh,
1856
2145
  clearCache: forceRuntimeRefresh || invalidation.changed
@@ -1892,7 +2181,7 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
1892
2181
  if (!forceRuntimeRefresh && !invalidation.changed && !forceCollectBySource && runtimeSet) {
1893
2182
  return runtimeSet;
1894
2183
  }
1895
- const task = _chunkVO2ZPNCWjs.collectRuntimeClassSet.call(void 0, runtimeState.twPatcher, {
2184
+ const task = _chunkWPH7LL5Vjs.collectRuntimeClassSet.call(void 0, runtimeState.twPatcher, {
1896
2185
  force: forceRuntimeRefresh || invalidation.changed || forceCollectBySource,
1897
2186
  skipRefresh: forceRuntimeRefresh,
1898
2187
  clearCache: forceRuntimeRefresh || invalidation.changed
@@ -1911,7 +2200,7 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
1911
2200
  const getResolvedConfig = () => resolvedConfig;
1912
2201
  const utsPlatform = _chunkDYLQ6UOIjs.resolveUniUtsPlatform.call(void 0, );
1913
2202
  const isIosPlatform = utsPlatform.isAppIos;
1914
- const uniAppXPlugins = uniAppX ? createUniAppXPlugins({
2203
+ const uniAppXPlugins = uniAppXEnabled ? createUniAppXPlugins({
1915
2204
  appType,
1916
2205
  customAttributesEntities,
1917
2206
  disabledDefaultTemplateHandler,
@@ -1921,12 +2210,13 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
1921
2210
  styleHandler,
1922
2211
  jsHandler,
1923
2212
  ensureRuntimeClassSet,
1924
- getResolvedConfig
2213
+ getResolvedConfig,
2214
+ uniAppX
1925
2215
  }) : void 0;
1926
2216
  const plugins = [
1927
2217
  ...rewritePlugins,
1928
2218
  {
1929
- name: `${_chunkVO2ZPNCWjs.vitePluginName}:post`,
2219
+ name: `${_chunkWPH7LL5Vjs.vitePluginName}:post`,
1930
2220
  enforce: "post",
1931
2221
  async configResolved(config) {
1932
2222
  resolvedConfig = config;