weapp-tailwindcss 4.7.2 → 4.7.4

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 (46) hide show
  1. package/dist/{chunk-Z2H7M33Z.mjs → chunk-6IYMPBCH.mjs} +107 -31
  2. package/dist/{chunk-5BW6X6AJ.mjs → chunk-FPX2BD2A.mjs} +2 -2
  3. package/dist/{chunk-2SI3KT2H.js → chunk-HMTZ4JJN.js} +2 -2
  4. package/dist/{chunk-GNWJEIZZ.js → chunk-I6FBWASF.js} +114 -38
  5. package/dist/{chunk-Q6PLZCM6.mjs → chunk-JII7EQ6K.mjs} +1 -1
  6. package/dist/{chunk-FPDJ3BCM.js → chunk-QA6SPWSQ.js} +120 -100
  7. package/dist/chunk-R7GWRQDJ.js +15 -0
  8. package/dist/chunk-SCOGAO45.mjs +18 -0
  9. package/dist/{chunk-OPTIAB5G.js → chunk-SIZNRUIV.js} +4 -4
  10. package/dist/{chunk-QZRXYCOQ.js → chunk-T5BSWDY2.js} +5 -5
  11. package/dist/{chunk-JYCQWWYU.mjs → chunk-V35QS2PT.mjs} +116 -96
  12. package/dist/cli.js +383 -15
  13. package/dist/cli.mjs +382 -15
  14. package/dist/core.js +4 -4
  15. package/dist/core.mjs +2 -2
  16. package/dist/css-macro/postcss.js +1 -1
  17. package/dist/css-macro/postcss.mjs +1 -1
  18. package/dist/css-macro.js +1 -1
  19. package/dist/css-macro.mjs +1 -1
  20. package/dist/defaults.js +1 -1
  21. package/dist/defaults.mjs +1 -1
  22. package/dist/escape.js +1 -1
  23. package/dist/escape.mjs +1 -1
  24. package/dist/gulp.js +5 -5
  25. package/dist/gulp.mjs +3 -3
  26. package/dist/index.js +7 -7
  27. package/dist/index.mjs +5 -5
  28. package/dist/postcss-html-transform.js +1 -1
  29. package/dist/postcss-html-transform.mjs +1 -1
  30. package/dist/presets.d.mts +2 -0
  31. package/dist/presets.d.ts +2 -0
  32. package/dist/presets.js +9 -5
  33. package/dist/presets.mjs +7 -3
  34. package/dist/types.d.mts +6 -0
  35. package/dist/types.d.ts +6 -0
  36. package/dist/types.js +1 -1
  37. package/dist/types.mjs +1 -1
  38. package/dist/vite.js +5 -5
  39. package/dist/vite.mjs +3 -3
  40. package/dist/webpack.js +5 -5
  41. package/dist/webpack.mjs +3 -3
  42. package/dist/webpack4.js +7 -7
  43. package/dist/webpack4.mjs +2 -2
  44. package/package.json +5 -3
  45. package/dist/chunk-4EUTRMUC.mjs +0 -10
  46. package/dist/chunk-QXSBMK2W.js +0 -7
@@ -12,10 +12,12 @@ import {
12
12
  createTailwindPatchPromise
13
13
  } from "./chunk-667CYXAH.mjs";
14
14
  import {
15
+ createAttributeMatcher,
15
16
  generateCode,
16
17
  getCompilerContext,
18
+ toCustomAttributesEntities,
17
19
  vitePluginName
18
- } from "./chunk-JYCQWWYU.mjs";
20
+ } from "./chunk-V35QS2PT.mjs";
19
21
  import {
20
22
  replaceWxml
21
23
  } from "./chunk-VSRDBMDB.mjs";
@@ -43,22 +45,40 @@ function traverse(node, visitor) {
43
45
  }
44
46
  }
45
47
  }
46
- function createClassAttributeUpdater(ms) {
47
- return (prop) => {
48
- if (prop.value) {
49
- ms.update(prop.value.loc.start.offset + 1, prop.value.loc.end.offset - 1, replaceWxml(prop.value.content));
50
- }
51
- };
48
+ function updateStaticAttribute(ms, prop) {
49
+ if (!prop.value) {
50
+ return;
51
+ }
52
+ const start = prop.value.loc.start.offset + 1;
53
+ const end = prop.value.loc.end.offset - 1;
54
+ if (start < end) {
55
+ ms.update(start, end, replaceWxml(prop.value.content));
56
+ }
52
57
  }
53
- function createClassDirectiveUpdater(ms, jsHandler, runtimeSet) {
54
- return (prop) => {
55
- if (prop.arg?.type === NodeTypes.SIMPLE_EXPRESSION && prop.arg.content === "class" && prop.exp?.type === NodeTypes.SIMPLE_EXPRESSION) {
56
- const generated = generateCode(prop.exp.content, {
57
- jsHandler,
58
- runtimeSet
59
- });
60
- ms.update(prop.exp.loc.start.offset, prop.exp.loc.end.offset, generated);
61
- }
58
+ function updateDirectiveExpression(ms, prop, jsHandler, runtimeSet) {
59
+ if (prop.exp?.type !== NodeTypes.SIMPLE_EXPRESSION) {
60
+ return;
61
+ }
62
+ const start = prop.exp.loc.start.offset;
63
+ const end = prop.exp.loc.end.offset;
64
+ if (start >= end) {
65
+ return;
66
+ }
67
+ const generated = generateCode(prop.exp.content, {
68
+ jsHandler,
69
+ runtimeSet,
70
+ wrapExpression: true
71
+ });
72
+ ms.update(start, end, generated);
73
+ }
74
+ function shouldHandleAttribute(tag, attrName, disabledDefaultTemplateHandler, matchCustomAttribute) {
75
+ const lowerName = attrName.toLowerCase();
76
+ const shouldHandleDefault = !disabledDefaultTemplateHandler && lowerName === "class";
77
+ const shouldHandleCustom = matchCustomAttribute?.(tag, attrName) ?? false;
78
+ return {
79
+ shouldHandleDefault,
80
+ shouldHandleCustom,
81
+ shouldHandle: shouldHandleDefault || shouldHandleCustom
62
82
  };
63
83
  }
64
84
  var defaultCreateJsHandlerOptions = {
@@ -68,25 +88,48 @@ var defaultCreateJsHandlerOptions = {
68
88
  ]
69
89
  }
70
90
  };
71
- function transformUVue(code, id, jsHandler, runtimeSet) {
72
- if (!/\.uvue(?:\?.*)?$/.test(id)) {
91
+ function transformUVue(code, id, jsHandler, runtimeSet, options = {}) {
92
+ if (!/\.(?:uvue|nvue)(?:\?.*)?$/.test(id)) {
73
93
  return;
74
94
  }
95
+ const { customAttributesEntities, disabledDefaultTemplateHandler = false } = options;
96
+ const matchCustomAttribute = createAttributeMatcher(customAttributesEntities);
75
97
  const ms = new MagicString(code);
76
98
  const { descriptor, errors } = parse(code);
77
99
  if (errors.length === 0) {
78
100
  if (descriptor.template?.ast) {
79
- const updateStaticClass = createClassAttributeUpdater(ms);
80
- const updateDynamicClass = createClassDirectiveUpdater(ms, jsHandler, runtimeSet);
81
101
  traverse(descriptor.template.ast, (node) => {
82
102
  if (node.type !== NodeTypes.ELEMENT) {
83
103
  return;
84
104
  }
105
+ const tag = node.tag;
85
106
  for (const prop of node.props) {
86
- if (prop.type === NodeTypes.ATTRIBUTE && prop.name === "class") {
87
- updateStaticClass(prop);
88
- } else if (prop.type === NodeTypes.DIRECTIVE && prop.name === "bind") {
89
- updateDynamicClass(prop);
107
+ if (prop.type === NodeTypes.ATTRIBUTE) {
108
+ const { shouldHandle, shouldHandleDefault } = shouldHandleAttribute(
109
+ tag,
110
+ prop.name,
111
+ disabledDefaultTemplateHandler,
112
+ matchCustomAttribute
113
+ );
114
+ if (!shouldHandle) {
115
+ continue;
116
+ }
117
+ updateStaticAttribute(ms, prop);
118
+ if (shouldHandleDefault) {
119
+ continue;
120
+ }
121
+ } else if (prop.type === NodeTypes.DIRECTIVE && prop.name === "bind" && prop.arg?.type === NodeTypes.SIMPLE_EXPRESSION && prop.arg.isStatic) {
122
+ const attrName = prop.arg.content;
123
+ const { shouldHandle } = shouldHandleAttribute(
124
+ tag,
125
+ attrName,
126
+ disabledDefaultTemplateHandler,
127
+ matchCustomAttribute
128
+ );
129
+ if (!shouldHandle) {
130
+ continue;
131
+ }
132
+ updateDirectiveExpression(ms, prop, jsHandler, runtimeSet);
90
133
  }
91
134
  }
92
135
  });
@@ -243,6 +286,7 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
243
286
  const opts = getCompilerContext(options);
244
287
  const {
245
288
  disabled,
289
+ customAttributes,
246
290
  onEnd,
247
291
  onLoad,
248
292
  onStart,
@@ -254,14 +298,36 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
254
298
  appType,
255
299
  cache,
256
300
  twPatcher,
257
- uniAppX
301
+ uniAppX,
302
+ disabledDefaultTemplateHandler
258
303
  } = opts;
259
304
  if (disabled) {
260
305
  return;
261
306
  }
307
+ const customAttributesEntities = toCustomAttributesEntities(customAttributes);
262
308
  const patchPromise = createTailwindPatchPromise(twPatcher);
263
309
  let runtimeSet;
310
+ let runtimeSetPromise;
264
311
  let resolvedConfig;
312
+ async function ensureRuntimeClassSet(force = false) {
313
+ await patchPromise;
314
+ if (!force && runtimeSet) {
315
+ return runtimeSet;
316
+ }
317
+ if (force || !runtimeSetPromise) {
318
+ const task2 = collectRuntimeClassSet(twPatcher, { force: force || !runtimeSet });
319
+ runtimeSetPromise = task2;
320
+ }
321
+ const task = runtimeSetPromise;
322
+ try {
323
+ runtimeSet = await task;
324
+ return runtimeSet;
325
+ } finally {
326
+ if (runtimeSetPromise === task) {
327
+ runtimeSetPromise = void 0;
328
+ }
329
+ }
330
+ }
265
331
  onLoad();
266
332
  const plugins = [
267
333
  {
@@ -297,8 +363,8 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
297
363
  }
298
364
  const moduleGraphOptions = createBundleModuleGraphOptions(outDir, jsEntries);
299
365
  const groupedEntries = getGroupedEntries(entries, opts);
300
- runtimeSet = await collectRuntimeClassSet(twPatcher, { force: true });
301
- debug("get runtimeSet, class count: %d", runtimeSet.size);
366
+ const runtime = await ensureRuntimeClassSet(true);
367
+ debug("get runtimeSet, class count: %d", runtime.size);
302
368
  const handleLinkedUpdate = (fileName, previous, next) => {
303
369
  onUpdate(fileName, previous, next);
304
370
  debug("js linked handle: %s", fileName);
@@ -510,11 +576,21 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
510
576
  name: "weapp-tailwindcss:uni-app-x:nvue",
511
577
  enforce: "pre",
512
578
  async buildStart() {
513
- await patchPromise;
514
- runtimeSet = await collectRuntimeClassSet(twPatcher, { force: true });
579
+ await ensureRuntimeClassSet(true);
515
580
  },
516
- transform(code, id) {
517
- return transformUVue(code, id, jsHandler, runtimeSet);
581
+ async transform(code, id) {
582
+ if (!/\.(?:uvue|nvue)(?:\?.*)?$/.test(id)) {
583
+ return;
584
+ }
585
+ const currentRuntimeSet = await ensureRuntimeClassSet();
586
+ const extraOptions = customAttributesEntities.length > 0 || disabledDefaultTemplateHandler ? {
587
+ customAttributesEntities,
588
+ disabledDefaultTemplateHandler
589
+ } : void 0;
590
+ if (extraOptions) {
591
+ return transformUVue(code, id, jsHandler, currentRuntimeSet, extraOptions);
592
+ }
593
+ return transformUVue(code, id, jsHandler, currentRuntimeSet);
518
594
  }
519
595
  }
520
596
  );
@@ -17,13 +17,13 @@ import {
17
17
  import {
18
18
  getCompilerContext,
19
19
  pluginName
20
- } from "./chunk-JYCQWWYU.mjs";
20
+ } from "./chunk-V35QS2PT.mjs";
21
21
  import {
22
22
  getGroupedEntries
23
23
  } from "./chunk-ZNKIYZRQ.mjs";
24
24
  import {
25
25
  __dirname
26
- } from "./chunk-4EUTRMUC.mjs";
26
+ } from "./chunk-SCOGAO45.mjs";
27
27
 
28
28
  // src/bundlers/webpack/BaseUnifiedPlugin/v5.ts
29
29
  import fs from "fs";
@@ -8,7 +8,7 @@ var _chunkLTJQUORKjs = require('./chunk-LTJQUORK.js');
8
8
  var _chunkBUMQQPAOjs = require('./chunk-BUMQQPAO.js');
9
9
 
10
10
 
11
- var _chunkFPDJ3BCMjs = require('./chunk-FPDJ3BCM.js');
11
+ var _chunkQA6SPWSQjs = require('./chunk-QA6SPWSQ.js');
12
12
 
13
13
  // src/bundlers/gulp/index.ts
14
14
  var _buffer = require('buffer');
@@ -19,7 +19,7 @@ var _stream = require('stream'); var _stream2 = _interopRequireDefault(_stream);
19
19
  var debug = _chunkBUMQQPAOjs.createDebug.call(void 0, );
20
20
  var Transform = _stream2.default.Transform;
21
21
  function createPlugins(options = {}) {
22
- const opts = _chunkFPDJ3BCMjs.getCompilerContext.call(void 0, options);
22
+ const opts = _chunkQA6SPWSQjs.getCompilerContext.call(void 0, options);
23
23
  const { templateHandler, styleHandler, jsHandler, cache, twPatcher } = opts;
24
24
  let runtimeSet = /* @__PURE__ */ new Set();
25
25
  const patchPromise = _chunkBUMQQPAOjs.createTailwindPatchPromise.call(void 0, twPatcher);
@@ -15,7 +15,9 @@ var _chunkBUMQQPAOjs = require('./chunk-BUMQQPAO.js');
15
15
 
16
16
 
17
17
 
18
- var _chunkFPDJ3BCMjs = require('./chunk-FPDJ3BCM.js');
18
+
19
+
20
+ var _chunkQA6SPWSQjs = require('./chunk-QA6SPWSQ.js');
19
21
 
20
22
 
21
23
  var _chunkDWAEHRHNjs = require('./chunk-DWAEHRHN.js');
@@ -43,22 +45,40 @@ function traverse(node, visitor) {
43
45
  }
44
46
  }
45
47
  }
46
- function createClassAttributeUpdater(ms) {
47
- return (prop) => {
48
- if (prop.value) {
49
- ms.update(prop.value.loc.start.offset + 1, prop.value.loc.end.offset - 1, _chunkDWAEHRHNjs.replaceWxml.call(void 0, prop.value.content));
50
- }
51
- };
48
+ function updateStaticAttribute(ms, prop) {
49
+ if (!prop.value) {
50
+ return;
51
+ }
52
+ const start = prop.value.loc.start.offset + 1;
53
+ const end = prop.value.loc.end.offset - 1;
54
+ if (start < end) {
55
+ ms.update(start, end, _chunkDWAEHRHNjs.replaceWxml.call(void 0, prop.value.content));
56
+ }
52
57
  }
53
- function createClassDirectiveUpdater(ms, jsHandler, runtimeSet) {
54
- return (prop) => {
55
- if (_optionalChain([prop, 'access', _ => _.arg, 'optionalAccess', _2 => _2.type]) === _compilerdom.NodeTypes.SIMPLE_EXPRESSION && prop.arg.content === "class" && _optionalChain([prop, 'access', _3 => _3.exp, 'optionalAccess', _4 => _4.type]) === _compilerdom.NodeTypes.SIMPLE_EXPRESSION) {
56
- const generated = _chunkFPDJ3BCMjs.generateCode.call(void 0, prop.exp.content, {
57
- jsHandler,
58
- runtimeSet
59
- });
60
- ms.update(prop.exp.loc.start.offset, prop.exp.loc.end.offset, generated);
61
- }
58
+ function updateDirectiveExpression(ms, prop, jsHandler, runtimeSet) {
59
+ if (_optionalChain([prop, 'access', _ => _.exp, 'optionalAccess', _2 => _2.type]) !== _compilerdom.NodeTypes.SIMPLE_EXPRESSION) {
60
+ return;
61
+ }
62
+ const start = prop.exp.loc.start.offset;
63
+ const end = prop.exp.loc.end.offset;
64
+ if (start >= end) {
65
+ return;
66
+ }
67
+ const generated = _chunkQA6SPWSQjs.generateCode.call(void 0, prop.exp.content, {
68
+ jsHandler,
69
+ runtimeSet,
70
+ wrapExpression: true
71
+ });
72
+ ms.update(start, end, generated);
73
+ }
74
+ function shouldHandleAttribute(tag, attrName, disabledDefaultTemplateHandler, matchCustomAttribute) {
75
+ const lowerName = attrName.toLowerCase();
76
+ const shouldHandleDefault = !disabledDefaultTemplateHandler && lowerName === "class";
77
+ const shouldHandleCustom = _nullishCoalesce(_optionalChain([matchCustomAttribute, 'optionalCall', _3 => _3(tag, attrName)]), () => ( false));
78
+ return {
79
+ shouldHandleDefault,
80
+ shouldHandleCustom,
81
+ shouldHandle: shouldHandleDefault || shouldHandleCustom
62
82
  };
63
83
  }
64
84
  var defaultCreateJsHandlerOptions = {
@@ -68,25 +88,48 @@ var defaultCreateJsHandlerOptions = {
68
88
  ]
69
89
  }
70
90
  };
71
- function transformUVue(code, id, jsHandler, runtimeSet) {
72
- if (!/\.uvue(?:\?.*)?$/.test(id)) {
91
+ function transformUVue(code, id, jsHandler, runtimeSet, options = {}) {
92
+ if (!/\.(?:uvue|nvue)(?:\?.*)?$/.test(id)) {
73
93
  return;
74
94
  }
95
+ const { customAttributesEntities, disabledDefaultTemplateHandler = false } = options;
96
+ const matchCustomAttribute = _chunkQA6SPWSQjs.createAttributeMatcher.call(void 0, customAttributesEntities);
75
97
  const ms = new (0, _magicstring2.default)(code);
76
98
  const { descriptor, errors } = _compilersfc.parse.call(void 0, code);
77
99
  if (errors.length === 0) {
78
- if (_optionalChain([descriptor, 'access', _5 => _5.template, 'optionalAccess', _6 => _6.ast])) {
79
- const updateStaticClass = createClassAttributeUpdater(ms);
80
- const updateDynamicClass = createClassDirectiveUpdater(ms, jsHandler, runtimeSet);
100
+ if (_optionalChain([descriptor, 'access', _4 => _4.template, 'optionalAccess', _5 => _5.ast])) {
81
101
  traverse(descriptor.template.ast, (node) => {
82
102
  if (node.type !== _compilerdom.NodeTypes.ELEMENT) {
83
103
  return;
84
104
  }
105
+ const tag = node.tag;
85
106
  for (const prop of node.props) {
86
- if (prop.type === _compilerdom.NodeTypes.ATTRIBUTE && prop.name === "class") {
87
- updateStaticClass(prop);
88
- } else if (prop.type === _compilerdom.NodeTypes.DIRECTIVE && prop.name === "bind") {
89
- updateDynamicClass(prop);
107
+ if (prop.type === _compilerdom.NodeTypes.ATTRIBUTE) {
108
+ const { shouldHandle, shouldHandleDefault } = shouldHandleAttribute(
109
+ tag,
110
+ prop.name,
111
+ disabledDefaultTemplateHandler,
112
+ matchCustomAttribute
113
+ );
114
+ if (!shouldHandle) {
115
+ continue;
116
+ }
117
+ updateStaticAttribute(ms, prop);
118
+ if (shouldHandleDefault) {
119
+ continue;
120
+ }
121
+ } 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) {
122
+ const attrName = prop.arg.content;
123
+ const { shouldHandle } = shouldHandleAttribute(
124
+ tag,
125
+ attrName,
126
+ disabledDefaultTemplateHandler,
127
+ matchCustomAttribute
128
+ );
129
+ if (!shouldHandle) {
130
+ continue;
131
+ }
132
+ updateDirectiveExpression(ms, prop, jsHandler, runtimeSet);
90
133
  }
91
134
  }
92
135
  });
@@ -235,14 +278,15 @@ function applyLinkedResults(linked, entries, onLinkedUpdate, onApplied) {
235
278
  } else {
236
279
  entry.output.source = code;
237
280
  }
238
- _optionalChain([onApplied, 'optionalCall', _7 => _7(entry, code)]);
281
+ _optionalChain([onApplied, 'optionalCall', _8 => _8(entry, code)]);
239
282
  onLinkedUpdate(entry.fileName, previous, code);
240
283
  }
241
284
  }
242
285
  function UnifiedViteWeappTailwindcssPlugin(options = {}) {
243
- const opts = _chunkFPDJ3BCMjs.getCompilerContext.call(void 0, options);
286
+ const opts = _chunkQA6SPWSQjs.getCompilerContext.call(void 0, options);
244
287
  const {
245
288
  disabled,
289
+ customAttributes,
246
290
  onEnd,
247
291
  onLoad,
248
292
  onStart,
@@ -254,18 +298,40 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
254
298
  appType,
255
299
  cache,
256
300
  twPatcher,
257
- uniAppX
301
+ uniAppX,
302
+ disabledDefaultTemplateHandler
258
303
  } = opts;
259
304
  if (disabled) {
260
305
  return;
261
306
  }
307
+ const customAttributesEntities = _chunkQA6SPWSQjs.toCustomAttributesEntities.call(void 0, customAttributes);
262
308
  const patchPromise = _chunkBUMQQPAOjs.createTailwindPatchPromise.call(void 0, twPatcher);
263
309
  let runtimeSet;
310
+ let runtimeSetPromise;
264
311
  let resolvedConfig;
312
+ async function ensureRuntimeClassSet(force = false) {
313
+ await patchPromise;
314
+ if (!force && runtimeSet) {
315
+ return runtimeSet;
316
+ }
317
+ if (force || !runtimeSetPromise) {
318
+ const task2 = _chunkBUMQQPAOjs.collectRuntimeClassSet.call(void 0, twPatcher, { force: force || !runtimeSet });
319
+ runtimeSetPromise = task2;
320
+ }
321
+ const task = runtimeSetPromise;
322
+ try {
323
+ runtimeSet = await task;
324
+ return runtimeSet;
325
+ } finally {
326
+ if (runtimeSetPromise === task) {
327
+ runtimeSetPromise = void 0;
328
+ }
329
+ }
330
+ }
265
331
  onLoad();
266
332
  const plugins = [
267
333
  {
268
- name: `${_chunkFPDJ3BCMjs.vitePluginName}:post`,
334
+ name: `${_chunkQA6SPWSQjs.vitePluginName}:post`,
269
335
  enforce: "post",
270
336
  configResolved(config) {
271
337
  resolvedConfig = config;
@@ -285,8 +351,8 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
285
351
  debug("start");
286
352
  onStart();
287
353
  const entries = Object.entries(bundle);
288
- const rootDir = _optionalChain([resolvedConfig, 'optionalAccess', _8 => _8.root]) ? _path2.default.resolve(resolvedConfig.root) : _process2.default.cwd();
289
- const outDir = _optionalChain([resolvedConfig, 'optionalAccess', _9 => _9.build, 'optionalAccess', _10 => _10.outDir]) ? _path2.default.resolve(rootDir, resolvedConfig.build.outDir) : rootDir;
354
+ const rootDir = _optionalChain([resolvedConfig, 'optionalAccess', _9 => _9.root]) ? _path2.default.resolve(resolvedConfig.root) : _process2.default.cwd();
355
+ const outDir = _optionalChain([resolvedConfig, 'optionalAccess', _10 => _10.build, 'optionalAccess', _11 => _11.outDir]) ? _path2.default.resolve(rootDir, resolvedConfig.build.outDir) : rootDir;
290
356
  const jsEntries = /* @__PURE__ */ new Map();
291
357
  for (const [fileName, output] of entries) {
292
358
  const entry = { fileName, output };
@@ -297,8 +363,8 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
297
363
  }
298
364
  const moduleGraphOptions = createBundleModuleGraphOptions(outDir, jsEntries);
299
365
  const groupedEntries = _chunkUW3WHSZ5js.getGroupedEntries.call(void 0, entries, opts);
300
- runtimeSet = await _chunkBUMQQPAOjs.collectRuntimeClassSet.call(void 0, twPatcher, { force: true });
301
- debug("get runtimeSet, class count: %d", runtimeSet.size);
366
+ const runtime = await ensureRuntimeClassSet(true);
367
+ debug("get runtimeSet, class count: %d", runtime.size);
302
368
  const handleLinkedUpdate = (fileName, previous, next) => {
303
369
  onUpdate(fileName, previous, next);
304
370
  debug("js linked handle: %s", fileName);
@@ -318,7 +384,7 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
318
384
  filename: absoluteFilename,
319
385
  moduleGraph: moduleGraphOptions,
320
386
  babelParserOptions: {
321
- ..._nullishCoalesce(_optionalChain([extra, 'optionalAccess', _11 => _11.babelParserOptions]), () => ( {})),
387
+ ..._nullishCoalesce(_optionalChain([extra, 'optionalAccess', _12 => _12.babelParserOptions]), () => ( {})),
322
388
  sourceFilename: absoluteFilename
323
389
  }
324
390
  });
@@ -510,11 +576,21 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
510
576
  name: "weapp-tailwindcss:uni-app-x:nvue",
511
577
  enforce: "pre",
512
578
  async buildStart() {
513
- await patchPromise;
514
- runtimeSet = await _chunkBUMQQPAOjs.collectRuntimeClassSet.call(void 0, twPatcher, { force: true });
579
+ await ensureRuntimeClassSet(true);
515
580
  },
516
- transform(code, id) {
517
- return transformUVue(code, id, jsHandler, runtimeSet);
581
+ async transform(code, id) {
582
+ if (!/\.(?:uvue|nvue)(?:\?.*)?$/.test(id)) {
583
+ return;
584
+ }
585
+ const currentRuntimeSet = await ensureRuntimeClassSet();
586
+ const extraOptions = customAttributesEntities.length > 0 || disabledDefaultTemplateHandler ? {
587
+ customAttributesEntities,
588
+ disabledDefaultTemplateHandler
589
+ } : void 0;
590
+ if (extraOptions) {
591
+ return transformUVue(code, id, jsHandler, currentRuntimeSet, extraOptions);
592
+ }
593
+ return transformUVue(code, id, jsHandler, currentRuntimeSet);
518
594
  }
519
595
  }
520
596
  );
@@ -8,7 +8,7 @@ import {
8
8
  } from "./chunk-667CYXAH.mjs";
9
9
  import {
10
10
  getCompilerContext
11
- } from "./chunk-JYCQWWYU.mjs";
11
+ } from "./chunk-V35QS2PT.mjs";
12
12
 
13
13
  // src/bundlers/gulp/index.ts
14
14
  import { Buffer } from "buffer";