weapp-tailwindcss 4.7.3 → 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.
- package/dist/{chunk-O3TOCTXE.mjs → chunk-6IYMPBCH.mjs} +107 -32
- package/dist/{chunk-CIBW3DQO.mjs → chunk-FPX2BD2A.mjs} +1 -1
- package/dist/{chunk-UAU6XVAY.js → chunk-HMTZ4JJN.js} +2 -2
- package/dist/{chunk-L2CHPESJ.js → chunk-I6FBWASF.js} +114 -39
- package/dist/{chunk-XFYWHJEU.mjs → chunk-JII7EQ6K.mjs} +1 -1
- package/dist/{chunk-JTGVWJ3Z.js → chunk-QA6SPWSQ.js} +97 -94
- package/dist/{chunk-2AAEKHNR.js → chunk-T5BSWDY2.js} +5 -5
- package/dist/{chunk-DXFNC4BP.mjs → chunk-V35QS2PT.mjs} +95 -92
- package/dist/cli.js +4 -4
- package/dist/cli.mjs +1 -1
- package/dist/core.js +2 -2
- package/dist/core.mjs +1 -1
- package/dist/gulp.js +3 -3
- package/dist/gulp.mjs +2 -2
- package/dist/index.js +5 -5
- package/dist/index.mjs +4 -4
- package/dist/presets.d.mts +2 -0
- package/dist/presets.d.ts +2 -0
- package/dist/presets.js +6 -2
- package/dist/presets.mjs +6 -2
- package/dist/vite.js +3 -3
- package/dist/vite.mjs +2 -2
- package/dist/webpack.js +3 -3
- package/dist/webpack.mjs +2 -2
- package/dist/webpack4.js +5 -5
- package/dist/webpack4.mjs +1 -1
- package/package.json +3 -3
|
@@ -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-
|
|
20
|
+
} from "./chunk-V35QS2PT.mjs";
|
|
19
21
|
import {
|
|
20
22
|
replaceWxml
|
|
21
23
|
} from "./chunk-VSRDBMDB.mjs";
|
|
@@ -43,23 +45,40 @@ function traverse(node, visitor) {
|
|
|
43
45
|
}
|
|
44
46
|
}
|
|
45
47
|
}
|
|
46
|
-
function
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
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
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
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
|
|
63
82
|
};
|
|
64
83
|
}
|
|
65
84
|
var defaultCreateJsHandlerOptions = {
|
|
@@ -69,25 +88,48 @@ var defaultCreateJsHandlerOptions = {
|
|
|
69
88
|
]
|
|
70
89
|
}
|
|
71
90
|
};
|
|
72
|
-
function transformUVue(code, id, jsHandler, runtimeSet) {
|
|
73
|
-
if (!/\.uvue(?:\?.*)?$/.test(id)) {
|
|
91
|
+
function transformUVue(code, id, jsHandler, runtimeSet, options = {}) {
|
|
92
|
+
if (!/\.(?:uvue|nvue)(?:\?.*)?$/.test(id)) {
|
|
74
93
|
return;
|
|
75
94
|
}
|
|
95
|
+
const { customAttributesEntities, disabledDefaultTemplateHandler = false } = options;
|
|
96
|
+
const matchCustomAttribute = createAttributeMatcher(customAttributesEntities);
|
|
76
97
|
const ms = new MagicString(code);
|
|
77
98
|
const { descriptor, errors } = parse(code);
|
|
78
99
|
if (errors.length === 0) {
|
|
79
100
|
if (descriptor.template?.ast) {
|
|
80
|
-
const updateStaticClass = createClassAttributeUpdater(ms);
|
|
81
|
-
const updateDynamicClass = createClassDirectiveUpdater(ms, jsHandler, runtimeSet);
|
|
82
101
|
traverse(descriptor.template.ast, (node) => {
|
|
83
102
|
if (node.type !== NodeTypes.ELEMENT) {
|
|
84
103
|
return;
|
|
85
104
|
}
|
|
105
|
+
const tag = node.tag;
|
|
86
106
|
for (const prop of node.props) {
|
|
87
|
-
if (prop.type === NodeTypes.ATTRIBUTE
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
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);
|
|
91
133
|
}
|
|
92
134
|
}
|
|
93
135
|
});
|
|
@@ -244,6 +286,7 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
|
|
|
244
286
|
const opts = getCompilerContext(options);
|
|
245
287
|
const {
|
|
246
288
|
disabled,
|
|
289
|
+
customAttributes,
|
|
247
290
|
onEnd,
|
|
248
291
|
onLoad,
|
|
249
292
|
onStart,
|
|
@@ -255,14 +298,36 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
|
|
|
255
298
|
appType,
|
|
256
299
|
cache,
|
|
257
300
|
twPatcher,
|
|
258
|
-
uniAppX
|
|
301
|
+
uniAppX,
|
|
302
|
+
disabledDefaultTemplateHandler
|
|
259
303
|
} = opts;
|
|
260
304
|
if (disabled) {
|
|
261
305
|
return;
|
|
262
306
|
}
|
|
307
|
+
const customAttributesEntities = toCustomAttributesEntities(customAttributes);
|
|
263
308
|
const patchPromise = createTailwindPatchPromise(twPatcher);
|
|
264
309
|
let runtimeSet;
|
|
310
|
+
let runtimeSetPromise;
|
|
265
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
|
+
}
|
|
266
331
|
onLoad();
|
|
267
332
|
const plugins = [
|
|
268
333
|
{
|
|
@@ -298,8 +363,8 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
|
|
|
298
363
|
}
|
|
299
364
|
const moduleGraphOptions = createBundleModuleGraphOptions(outDir, jsEntries);
|
|
300
365
|
const groupedEntries = getGroupedEntries(entries, opts);
|
|
301
|
-
|
|
302
|
-
debug("get runtimeSet, class count: %d",
|
|
366
|
+
const runtime = await ensureRuntimeClassSet(true);
|
|
367
|
+
debug("get runtimeSet, class count: %d", runtime.size);
|
|
303
368
|
const handleLinkedUpdate = (fileName, previous, next) => {
|
|
304
369
|
onUpdate(fileName, previous, next);
|
|
305
370
|
debug("js linked handle: %s", fileName);
|
|
@@ -511,11 +576,21 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
|
|
|
511
576
|
name: "weapp-tailwindcss:uni-app-x:nvue",
|
|
512
577
|
enforce: "pre",
|
|
513
578
|
async buildStart() {
|
|
514
|
-
await
|
|
515
|
-
runtimeSet = await collectRuntimeClassSet(twPatcher, { force: true });
|
|
579
|
+
await ensureRuntimeClassSet(true);
|
|
516
580
|
},
|
|
517
|
-
transform(code, id) {
|
|
518
|
-
|
|
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);
|
|
519
594
|
}
|
|
520
595
|
}
|
|
521
596
|
);
|
|
@@ -8,7 +8,7 @@ var _chunkLTJQUORKjs = require('./chunk-LTJQUORK.js');
|
|
|
8
8
|
var _chunkBUMQQPAOjs = require('./chunk-BUMQQPAO.js');
|
|
9
9
|
|
|
10
10
|
|
|
11
|
-
var
|
|
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 =
|
|
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
|
-
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
var _chunkQA6SPWSQjs = require('./chunk-QA6SPWSQ.js');
|
|
19
21
|
|
|
20
22
|
|
|
21
23
|
var _chunkDWAEHRHNjs = require('./chunk-DWAEHRHN.js');
|
|
@@ -43,23 +45,40 @@ function traverse(node, visitor) {
|
|
|
43
45
|
}
|
|
44
46
|
}
|
|
45
47
|
}
|
|
46
|
-
function
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
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
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
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
|
|
63
82
|
};
|
|
64
83
|
}
|
|
65
84
|
var defaultCreateJsHandlerOptions = {
|
|
@@ -69,25 +88,48 @@ var defaultCreateJsHandlerOptions = {
|
|
|
69
88
|
]
|
|
70
89
|
}
|
|
71
90
|
};
|
|
72
|
-
function transformUVue(code, id, jsHandler, runtimeSet) {
|
|
73
|
-
if (!/\.uvue(?:\?.*)?$/.test(id)) {
|
|
91
|
+
function transformUVue(code, id, jsHandler, runtimeSet, options = {}) {
|
|
92
|
+
if (!/\.(?:uvue|nvue)(?:\?.*)?$/.test(id)) {
|
|
74
93
|
return;
|
|
75
94
|
}
|
|
95
|
+
const { customAttributesEntities, disabledDefaultTemplateHandler = false } = options;
|
|
96
|
+
const matchCustomAttribute = _chunkQA6SPWSQjs.createAttributeMatcher.call(void 0, customAttributesEntities);
|
|
76
97
|
const ms = new (0, _magicstring2.default)(code);
|
|
77
98
|
const { descriptor, errors } = _compilersfc.parse.call(void 0, code);
|
|
78
99
|
if (errors.length === 0) {
|
|
79
|
-
if (_optionalChain([descriptor, 'access',
|
|
80
|
-
const updateStaticClass = createClassAttributeUpdater(ms);
|
|
81
|
-
const updateDynamicClass = createClassDirectiveUpdater(ms, jsHandler, runtimeSet);
|
|
100
|
+
if (_optionalChain([descriptor, 'access', _4 => _4.template, 'optionalAccess', _5 => _5.ast])) {
|
|
82
101
|
traverse(descriptor.template.ast, (node) => {
|
|
83
102
|
if (node.type !== _compilerdom.NodeTypes.ELEMENT) {
|
|
84
103
|
return;
|
|
85
104
|
}
|
|
105
|
+
const tag = node.tag;
|
|
86
106
|
for (const prop of node.props) {
|
|
87
|
-
if (prop.type === _compilerdom.NodeTypes.ATTRIBUTE
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
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);
|
|
91
133
|
}
|
|
92
134
|
}
|
|
93
135
|
});
|
|
@@ -236,14 +278,15 @@ function applyLinkedResults(linked, entries, onLinkedUpdate, onApplied) {
|
|
|
236
278
|
} else {
|
|
237
279
|
entry.output.source = code;
|
|
238
280
|
}
|
|
239
|
-
_optionalChain([onApplied, 'optionalCall',
|
|
281
|
+
_optionalChain([onApplied, 'optionalCall', _8 => _8(entry, code)]);
|
|
240
282
|
onLinkedUpdate(entry.fileName, previous, code);
|
|
241
283
|
}
|
|
242
284
|
}
|
|
243
285
|
function UnifiedViteWeappTailwindcssPlugin(options = {}) {
|
|
244
|
-
const opts =
|
|
286
|
+
const opts = _chunkQA6SPWSQjs.getCompilerContext.call(void 0, options);
|
|
245
287
|
const {
|
|
246
288
|
disabled,
|
|
289
|
+
customAttributes,
|
|
247
290
|
onEnd,
|
|
248
291
|
onLoad,
|
|
249
292
|
onStart,
|
|
@@ -255,18 +298,40 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
|
|
|
255
298
|
appType,
|
|
256
299
|
cache,
|
|
257
300
|
twPatcher,
|
|
258
|
-
uniAppX
|
|
301
|
+
uniAppX,
|
|
302
|
+
disabledDefaultTemplateHandler
|
|
259
303
|
} = opts;
|
|
260
304
|
if (disabled) {
|
|
261
305
|
return;
|
|
262
306
|
}
|
|
307
|
+
const customAttributesEntities = _chunkQA6SPWSQjs.toCustomAttributesEntities.call(void 0, customAttributes);
|
|
263
308
|
const patchPromise = _chunkBUMQQPAOjs.createTailwindPatchPromise.call(void 0, twPatcher);
|
|
264
309
|
let runtimeSet;
|
|
310
|
+
let runtimeSetPromise;
|
|
265
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
|
+
}
|
|
266
331
|
onLoad();
|
|
267
332
|
const plugins = [
|
|
268
333
|
{
|
|
269
|
-
name: `${
|
|
334
|
+
name: `${_chunkQA6SPWSQjs.vitePluginName}:post`,
|
|
270
335
|
enforce: "post",
|
|
271
336
|
configResolved(config) {
|
|
272
337
|
resolvedConfig = config;
|
|
@@ -286,8 +351,8 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
|
|
|
286
351
|
debug("start");
|
|
287
352
|
onStart();
|
|
288
353
|
const entries = Object.entries(bundle);
|
|
289
|
-
const rootDir = _optionalChain([resolvedConfig, 'optionalAccess',
|
|
290
|
-
const outDir = _optionalChain([resolvedConfig, 'optionalAccess',
|
|
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;
|
|
291
356
|
const jsEntries = /* @__PURE__ */ new Map();
|
|
292
357
|
for (const [fileName, output] of entries) {
|
|
293
358
|
const entry = { fileName, output };
|
|
@@ -298,8 +363,8 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
|
|
|
298
363
|
}
|
|
299
364
|
const moduleGraphOptions = createBundleModuleGraphOptions(outDir, jsEntries);
|
|
300
365
|
const groupedEntries = _chunkUW3WHSZ5js.getGroupedEntries.call(void 0, entries, opts);
|
|
301
|
-
|
|
302
|
-
debug("get runtimeSet, class count: %d",
|
|
366
|
+
const runtime = await ensureRuntimeClassSet(true);
|
|
367
|
+
debug("get runtimeSet, class count: %d", runtime.size);
|
|
303
368
|
const handleLinkedUpdate = (fileName, previous, next) => {
|
|
304
369
|
onUpdate(fileName, previous, next);
|
|
305
370
|
debug("js linked handle: %s", fileName);
|
|
@@ -319,7 +384,7 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
|
|
|
319
384
|
filename: absoluteFilename,
|
|
320
385
|
moduleGraph: moduleGraphOptions,
|
|
321
386
|
babelParserOptions: {
|
|
322
|
-
..._nullishCoalesce(_optionalChain([extra, 'optionalAccess',
|
|
387
|
+
..._nullishCoalesce(_optionalChain([extra, 'optionalAccess', _12 => _12.babelParserOptions]), () => ( {})),
|
|
323
388
|
sourceFilename: absoluteFilename
|
|
324
389
|
}
|
|
325
390
|
});
|
|
@@ -511,11 +576,21 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
|
|
|
511
576
|
name: "weapp-tailwindcss:uni-app-x:nvue",
|
|
512
577
|
enforce: "pre",
|
|
513
578
|
async buildStart() {
|
|
514
|
-
await
|
|
515
|
-
runtimeSet = await _chunkBUMQQPAOjs.collectRuntimeClassSet.call(void 0, twPatcher, { force: true });
|
|
579
|
+
await ensureRuntimeClassSet(true);
|
|
516
580
|
},
|
|
517
|
-
transform(code, id) {
|
|
518
|
-
|
|
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);
|
|
519
594
|
}
|
|
520
595
|
}
|
|
521
596
|
);
|