weapp-tailwindcss 4.11.2 → 4.12.0-alpha.2
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/README.md +38 -0
- package/bin/weapp-tailwindcss.js +21 -1
- package/dist/{chunk-AV3XB6EQ.js → chunk-2A4NRLSY.js} +5 -5
- package/dist/{chunk-WJIRXC26.js → chunk-6JBFHYFM.js} +134 -128
- package/dist/{chunk-OMARW5NC.mjs → chunk-AYJ4HLWZ.mjs} +4 -2
- package/dist/{chunk-W3DXDWYC.mjs → chunk-CMNCGACY.mjs} +66 -60
- package/dist/{chunk-ZZ36BKM5.mjs → chunk-CQMHHQRN.mjs} +6 -2
- package/dist/{chunk-OYSABARD.js → chunk-E7I5TW5K.js} +3 -2
- package/dist/{chunk-7LKMJZD2.js → chunk-GMKSBLNY.js} +2 -2
- package/dist/{chunk-EFBQ4SQR.mjs → chunk-HL3US2OT.mjs} +1 -1
- package/dist/{chunk-AB2RGZQO.mjs → chunk-LWEVOVRD.mjs} +144 -76
- package/dist/{chunk-QK6VNNNL.js → chunk-NIS74SI6.js} +8 -6
- package/dist/{chunk-CRDOWYG4.js → chunk-ONLKZIRQ.js} +1 -1
- package/dist/{chunk-3QHYEMEW.js → chunk-PAAX4FDD.js} +45 -40
- package/dist/{chunk-JIERVBTX.mjs → chunk-SHDJA4GG.mjs} +1 -1
- package/dist/{chunk-SUKOZ6OG.js → chunk-SRAG3FST.js} +10 -6
- package/dist/{chunk-TT5WHNGS.js → chunk-YVRX3F6S.js} +149 -81
- package/dist/{chunk-2LH6PZH3.mjs → chunk-ZCH4YINE.mjs} +3 -2
- package/dist/{chunk-VGPAKLMZ.mjs → chunk-ZGIN2OAY.mjs} +12 -7
- package/dist/cli.js +2233 -158
- package/dist/cli.mjs +2238 -163
- package/dist/core.d.mts +1 -1
- package/dist/core.d.ts +1 -1
- package/dist/core.js +14 -9
- package/dist/core.mjs +10 -5
- package/dist/css-macro/postcss.js +4 -4
- package/dist/css-macro/postcss.mjs +2 -2
- package/dist/css-macro.js +5 -5
- package/dist/css-macro.mjs +2 -2
- package/dist/defaults.d.mts +1 -1
- package/dist/defaults.d.ts +1 -1
- package/dist/defaults.js +1 -1
- package/dist/defaults.mjs +1 -1
- package/dist/gulp.d.mts +1 -1
- package/dist/gulp.d.ts +1 -1
- package/dist/gulp.js +5 -5
- package/dist/gulp.mjs +4 -4
- package/dist/{index-CoXntW_P.d.mts → index-BXrmQelt.d.mts} +29 -1
- package/dist/{index-CoXntW_P.d.ts → index-BXrmQelt.d.ts} +29 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +9 -9
- package/dist/index.mjs +7 -7
- package/dist/postcss-html-transform.js +1 -1
- package/dist/postcss-html-transform.mjs +1 -1
- package/dist/presets.d.mts +8 -1
- package/dist/presets.d.ts +8 -1
- package/dist/presets.js +7 -6
- package/dist/presets.mjs +3 -2
- package/dist/reset.d.mts +1 -31
- package/dist/reset.d.ts +3 -32
- package/dist/reset.js +3 -160
- package/dist/reset.mjs +3 -160
- package/dist/types.d.mts +2 -2
- package/dist/types.d.ts +2 -2
- package/dist/types.js +1 -1
- package/dist/types.mjs +1 -1
- package/dist/vite.d.mts +1 -1
- package/dist/vite.d.ts +1 -1
- package/dist/vite.js +6 -6
- package/dist/vite.mjs +4 -4
- package/dist/weapp-tw-css-import-rewrite-loader.js +10 -5
- package/dist/weapp-tw-runtime-classset-loader.js +9 -4
- package/dist/webpack.d.mts +1 -1
- package/dist/webpack.d.ts +1 -1
- package/dist/webpack.js +7 -7
- package/dist/webpack.mjs +5 -5
- package/dist/webpack4.d.mts +1 -1
- package/dist/webpack4.d.ts +1 -1
- package/dist/webpack4.js +65 -56
- package/dist/webpack4.mjs +35 -26
- package/package.json +12 -7
- package/scripts/postinstall.mjs +59 -0
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
var
|
|
9
|
+
var _chunkGMKSBLNYjs = require('./chunk-GMKSBLNY.js');
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
var _chunkOF6MFURRjs = require('./chunk-OF6MFURR.js');
|
|
@@ -26,21 +26,23 @@ var _chunkOF6MFURRjs = require('./chunk-OF6MFURR.js');
|
|
|
26
26
|
|
|
27
27
|
|
|
28
28
|
|
|
29
|
-
var _chunkTT5WHNGSjs = require('./chunk-TT5WHNGS.js');
|
|
30
29
|
|
|
30
|
+
var _chunkYVRX3F6Sjs = require('./chunk-YVRX3F6S.js');
|
|
31
31
|
|
|
32
32
|
|
|
33
33
|
|
|
34
34
|
|
|
35
35
|
|
|
36
36
|
|
|
37
|
-
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
var _chunkNIS74SI6js = require('./chunk-NIS74SI6.js');
|
|
38
40
|
|
|
39
41
|
|
|
40
42
|
var _chunkDYLQ6UOIjs = require('./chunk-DYLQ6UOI.js');
|
|
41
43
|
|
|
42
44
|
|
|
43
|
-
var
|
|
45
|
+
var _chunkONLKZIRQjs = require('./chunk-ONLKZIRQ.js');
|
|
44
46
|
|
|
45
47
|
// src/bundlers/vite/index.ts
|
|
46
48
|
var _fs = require('fs'); var _fs2 = _interopRequireDefault(_fs);
|
|
@@ -90,7 +92,7 @@ function isRuntimeCandidate(candidate, runtimeSet) {
|
|
|
90
92
|
if (!runtimeSet || runtimeSet.size === 0) {
|
|
91
93
|
return false;
|
|
92
94
|
}
|
|
93
|
-
return runtimeSet.has(candidate) || runtimeSet.has(
|
|
95
|
+
return runtimeSet.has(candidate) || runtimeSet.has(_chunkYVRX3F6Sjs.replaceWxml.call(void 0, candidate));
|
|
94
96
|
}
|
|
95
97
|
function shouldEnableComponentLocalStyle(id) {
|
|
96
98
|
return COMPONENT_RE.test(id);
|
|
@@ -110,7 +112,7 @@ var UniAppXComponentLocalStyleCollector = class {
|
|
|
110
112
|
const alias = createAlias(this.fileId, utility, this.aliasByUtility.size);
|
|
111
113
|
this.aliasByUtility.set(utility, alias);
|
|
112
114
|
this.aliasByLookup.set(utility, alias);
|
|
113
|
-
this.aliasByLookup.set(
|
|
115
|
+
this.aliasByLookup.set(_chunkYVRX3F6Sjs.replaceWxml.call(void 0, utility), alias);
|
|
114
116
|
return alias;
|
|
115
117
|
}
|
|
116
118
|
rewriteLiteral(literal, shouldInclude) {
|
|
@@ -133,15 +135,15 @@ var UniAppXComponentLocalStyleCollector = class {
|
|
|
133
135
|
collectRuntimeClasses(rawSource, options = {}) {
|
|
134
136
|
const wrapped = options.wrapExpression ? `${EXPRESSION_WRAPPER_PREFIX}${rawSource}${EXPRESSION_WRAPPER_SUFFIX}` : rawSource;
|
|
135
137
|
try {
|
|
136
|
-
const ast =
|
|
138
|
+
const ast = _chunkYVRX3F6Sjs.babelParse.call(void 0, wrapped, {
|
|
137
139
|
plugins: ["typescript"],
|
|
138
140
|
sourceType: options.wrapExpression ? "module" : "unambiguous"
|
|
139
141
|
});
|
|
140
|
-
const analysis =
|
|
142
|
+
const analysis = _chunkYVRX3F6Sjs.analyzeSource.call(void 0, ast, {}, void 0, false);
|
|
141
143
|
for (const path7 of analysis.targetPaths) {
|
|
142
144
|
const { literal, allowDoubleQuotes } = extractLiteralValue(path7);
|
|
143
145
|
const candidates = _extractors.splitCode.call(void 0, literal, allowDoubleQuotes);
|
|
144
|
-
const classContext = options.wrapExpression ||
|
|
146
|
+
const classContext = options.wrapExpression || _chunkYVRX3F6Sjs.isClassContextLiteralPath.call(void 0, path7);
|
|
145
147
|
for (const candidate of candidates) {
|
|
146
148
|
if (!candidate || !classContext && !isRuntimeCandidate(candidate, this.runtimeSet)) {
|
|
147
149
|
continue;
|
|
@@ -160,15 +162,15 @@ var UniAppXComponentLocalStyleCollector = class {
|
|
|
160
162
|
}
|
|
161
163
|
const wrapped = options.wrapExpression ? `${EXPRESSION_WRAPPER_PREFIX}${rawSource}${EXPRESSION_WRAPPER_SUFFIX}` : rawSource;
|
|
162
164
|
try {
|
|
163
|
-
const ast =
|
|
165
|
+
const ast = _chunkYVRX3F6Sjs.babelParse.call(void 0, wrapped, {
|
|
164
166
|
plugins: ["typescript"],
|
|
165
167
|
sourceType: options.wrapExpression ? "module" : "unambiguous"
|
|
166
168
|
});
|
|
167
|
-
const analysis =
|
|
169
|
+
const analysis = _chunkYVRX3F6Sjs.analyzeSource.call(void 0, ast, {}, void 0, false);
|
|
168
170
|
if (analysis.targetPaths.length === 0) {
|
|
169
171
|
return rawSource;
|
|
170
172
|
}
|
|
171
|
-
const updater = new (0,
|
|
173
|
+
const updater = new (0, _chunkYVRX3F6Sjs.JsTokenUpdater)();
|
|
172
174
|
for (const path7 of analysis.targetPaths) {
|
|
173
175
|
const { literal, allowDoubleQuotes, offset } = extractLiteralValue(path7);
|
|
174
176
|
const candidates = _extractors.splitCode.call(void 0, literal, allowDoubleQuotes);
|
|
@@ -242,28 +244,28 @@ function traverse2(node, visitor) {
|
|
|
242
244
|
}
|
|
243
245
|
}
|
|
244
246
|
}
|
|
245
|
-
function updateStaticAttribute(ms, prop) {
|
|
247
|
+
function updateStaticAttribute(ms, prop, content = _optionalChain([prop, 'access', _ => _.value, 'optionalAccess', _2 => _2.content])) {
|
|
246
248
|
if (!prop.value) {
|
|
247
249
|
return;
|
|
248
250
|
}
|
|
249
251
|
const start = prop.value.loc.start.offset + 1;
|
|
250
252
|
const end = prop.value.loc.end.offset - 1;
|
|
251
253
|
if (start < end) {
|
|
252
|
-
ms.update(start, end,
|
|
254
|
+
ms.update(start, end, _chunkYVRX3F6Sjs.replaceWxml.call(void 0, _nullishCoalesce(content, () => ( ""))));
|
|
253
255
|
}
|
|
254
256
|
}
|
|
255
|
-
function updateStaticAttributeWithLocalStyle(ms, prop, collector) {
|
|
257
|
+
function updateStaticAttributeWithLocalStyle(ms, prop, collector, content = _optionalChain([prop, 'access', _3 => _3.value, 'optionalAccess', _4 => _4.content])) {
|
|
256
258
|
if (!prop.value) {
|
|
257
259
|
return;
|
|
258
260
|
}
|
|
259
261
|
const start = prop.value.loc.start.offset + 1;
|
|
260
262
|
const end = prop.value.loc.end.offset - 1;
|
|
261
263
|
if (start < end) {
|
|
262
|
-
ms.update(start, end, collector.collectAndRewriteStaticClass(
|
|
264
|
+
ms.update(start, end, collector.collectAndRewriteStaticClass(_nullishCoalesce(content, () => ( ""))));
|
|
263
265
|
}
|
|
264
266
|
}
|
|
265
|
-
function updateDirectiveExpression(ms, prop, jsHandler, runtimeSet) {
|
|
266
|
-
if (_optionalChain([prop, 'access',
|
|
267
|
+
function updateDirectiveExpression(ms, prop, jsHandler, runtimeSet, expression = _optionalChain([prop, 'access', _5 => _5.exp, 'optionalAccess', _6 => _6.content])) {
|
|
268
|
+
if (_optionalChain([prop, 'access', _7 => _7.exp, 'optionalAccess', _8 => _8.type]) !== _compilerdom.NodeTypes.SIMPLE_EXPRESSION || expression === void 0) {
|
|
267
269
|
return;
|
|
268
270
|
}
|
|
269
271
|
const start = prop.exp.loc.start.offset;
|
|
@@ -271,15 +273,15 @@ function updateDirectiveExpression(ms, prop, jsHandler, runtimeSet) {
|
|
|
271
273
|
if (start >= end) {
|
|
272
274
|
return;
|
|
273
275
|
}
|
|
274
|
-
const generated =
|
|
276
|
+
const generated = _chunkYVRX3F6Sjs.generateCode.call(void 0, expression, {
|
|
275
277
|
jsHandler,
|
|
276
278
|
runtimeSet,
|
|
277
279
|
wrapExpression: true
|
|
278
280
|
});
|
|
279
281
|
ms.update(start, end, generated);
|
|
280
282
|
}
|
|
281
|
-
function updateDirectiveExpressionWithLocalStyle(ms, prop, jsHandler, collector, runtimeSet) {
|
|
282
|
-
if (_optionalChain([prop, 'access',
|
|
283
|
+
function updateDirectiveExpressionWithLocalStyle(ms, prop, jsHandler, collector, runtimeSet, expression = _optionalChain([prop, 'access', _9 => _9.exp, 'optionalAccess', _10 => _10.content])) {
|
|
284
|
+
if (_optionalChain([prop, 'access', _11 => _11.exp, 'optionalAccess', _12 => _12.type]) !== _compilerdom.NodeTypes.SIMPLE_EXPRESSION || expression === void 0) {
|
|
283
285
|
return;
|
|
284
286
|
}
|
|
285
287
|
const start = prop.exp.loc.start.offset;
|
|
@@ -287,10 +289,10 @@ function updateDirectiveExpressionWithLocalStyle(ms, prop, jsHandler, collector,
|
|
|
287
289
|
if (start >= end) {
|
|
288
290
|
return;
|
|
289
291
|
}
|
|
290
|
-
collector.collectRuntimeClasses(
|
|
292
|
+
collector.collectRuntimeClasses(expression, {
|
|
291
293
|
wrapExpression: true
|
|
292
294
|
});
|
|
293
|
-
const generated =
|
|
295
|
+
const generated = _chunkYVRX3F6Sjs.generateCode.call(void 0, expression, {
|
|
294
296
|
jsHandler,
|
|
295
297
|
runtimeSet,
|
|
296
298
|
wrapExpression: true
|
|
@@ -300,7 +302,7 @@ function updateDirectiveExpressionWithLocalStyle(ms, prop, jsHandler, collector,
|
|
|
300
302
|
function shouldHandleAttribute(tag, attrName, disabledDefaultTemplateHandler, matchCustomAttribute) {
|
|
301
303
|
const lowerName = attrName.toLowerCase();
|
|
302
304
|
const shouldHandleDefault = !disabledDefaultTemplateHandler && lowerName === "class";
|
|
303
|
-
const shouldHandleCustom = _nullishCoalesce(_optionalChain([matchCustomAttribute, 'optionalCall',
|
|
305
|
+
const shouldHandleCustom = _nullishCoalesce(_optionalChain([matchCustomAttribute, 'optionalCall', _13 => _13(tag, attrName)]), () => ( false));
|
|
304
306
|
return {
|
|
305
307
|
shouldHandleDefault,
|
|
306
308
|
shouldHandleCustom,
|
|
@@ -320,12 +322,12 @@ function transformUVue(code, id, jsHandler, runtimeSet, options = {}) {
|
|
|
320
322
|
return;
|
|
321
323
|
}
|
|
322
324
|
const { customAttributesEntities, disabledDefaultTemplateHandler = false } = options;
|
|
323
|
-
const matchCustomAttribute =
|
|
325
|
+
const matchCustomAttribute = _chunkYVRX3F6Sjs.createAttributeMatcher.call(void 0, customAttributesEntities);
|
|
324
326
|
const ms = new (0, _magicstring2.default)(code);
|
|
325
327
|
const { descriptor, errors } = _compilersfc.parse.call(void 0, code);
|
|
326
328
|
const localStyleCollector = options.enableComponentLocalStyle && shouldEnableComponentLocalStyle(id) ? new UniAppXComponentLocalStyleCollector(id, runtimeSet) : void 0;
|
|
327
329
|
if (errors.length === 0) {
|
|
328
|
-
if (_optionalChain([descriptor, 'access',
|
|
330
|
+
if (_optionalChain([descriptor, 'access', _14 => _14.template, 'optionalAccess', _15 => _15.ast])) {
|
|
329
331
|
traverse2(descriptor.template.ast, (node) => {
|
|
330
332
|
if (node.type !== _compilerdom.NodeTypes.ELEMENT) {
|
|
331
333
|
return;
|
|
@@ -350,7 +352,7 @@ function transformUVue(code, id, jsHandler, runtimeSet, options = {}) {
|
|
|
350
352
|
if (shouldHandleDefault) {
|
|
351
353
|
continue;
|
|
352
354
|
}
|
|
353
|
-
} else if (prop.type === _compilerdom.NodeTypes.DIRECTIVE && prop.name === "bind" && _optionalChain([prop, 'access',
|
|
355
|
+
} else if (prop.type === _compilerdom.NodeTypes.DIRECTIVE && prop.name === "bind" && _optionalChain([prop, 'access', _16 => _16.arg, 'optionalAccess', _17 => _17.type]) === _compilerdom.NodeTypes.SIMPLE_EXPRESSION && prop.arg.isStatic) {
|
|
354
356
|
const attrName = prop.arg.content;
|
|
355
357
|
const { shouldHandle } = shouldHandleAttribute(
|
|
356
358
|
tag,
|
|
@@ -362,7 +364,13 @@ function transformUVue(code, id, jsHandler, runtimeSet, options = {}) {
|
|
|
362
364
|
continue;
|
|
363
365
|
}
|
|
364
366
|
if (attrName.toLowerCase() === "class" && localStyleCollector) {
|
|
365
|
-
updateDirectiveExpressionWithLocalStyle(
|
|
367
|
+
updateDirectiveExpressionWithLocalStyle(
|
|
368
|
+
ms,
|
|
369
|
+
prop,
|
|
370
|
+
jsHandler,
|
|
371
|
+
localStyleCollector,
|
|
372
|
+
runtimeSet
|
|
373
|
+
);
|
|
366
374
|
} else {
|
|
367
375
|
updateDirectiveExpression(ms, prop, jsHandler, runtimeSet);
|
|
368
376
|
}
|
|
@@ -371,7 +379,7 @@ function transformUVue(code, id, jsHandler, runtimeSet, options = {}) {
|
|
|
371
379
|
});
|
|
372
380
|
}
|
|
373
381
|
if (descriptor.script) {
|
|
374
|
-
_optionalChain([localStyleCollector, 'optionalAccess',
|
|
382
|
+
_optionalChain([localStyleCollector, 'optionalAccess', _18 => _18.collectRuntimeClasses, 'call', _19 => _19(descriptor.script.content)]);
|
|
375
383
|
const { code: code2 } = jsHandler(descriptor.script.content, _nullishCoalesce(runtimeSet, () => ( /* @__PURE__ */ new Set())), defaultCreateJsHandlerOptions);
|
|
376
384
|
ms.update(
|
|
377
385
|
descriptor.script.loc.start.offset,
|
|
@@ -380,7 +388,7 @@ function transformUVue(code, id, jsHandler, runtimeSet, options = {}) {
|
|
|
380
388
|
);
|
|
381
389
|
}
|
|
382
390
|
if (descriptor.scriptSetup) {
|
|
383
|
-
_optionalChain([localStyleCollector, 'optionalAccess',
|
|
391
|
+
_optionalChain([localStyleCollector, 'optionalAccess', _20 => _20.collectRuntimeClasses, 'call', _21 => _21(descriptor.scriptSetup.content)]);
|
|
384
392
|
const { code: code2 } = jsHandler(descriptor.scriptSetup.content, _nullishCoalesce(runtimeSet, () => ( /* @__PURE__ */ new Set())), defaultCreateJsHandlerOptions);
|
|
385
393
|
ms.update(
|
|
386
394
|
descriptor.scriptSetup.loc.start.offset,
|
|
@@ -388,18 +396,22 @@ function transformUVue(code, id, jsHandler, runtimeSet, options = {}) {
|
|
|
388
396
|
localStyleCollector ? localStyleCollector.rewriteTransformedCode(code2) : code2
|
|
389
397
|
);
|
|
390
398
|
}
|
|
391
|
-
if (_optionalChain([localStyleCollector, 'optionalAccess',
|
|
399
|
+
if (_optionalChain([localStyleCollector, 'optionalAccess', _22 => _22.hasStyles, 'call', _23 => _23()])) {
|
|
392
400
|
ms.append(`
|
|
393
401
|
${localStyleCollector.toStyleBlock()}`);
|
|
394
402
|
}
|
|
395
403
|
}
|
|
396
|
-
|
|
397
|
-
code: ms.toString()
|
|
398
|
-
|
|
399
|
-
|
|
404
|
+
const result = {
|
|
405
|
+
code: ms.toString()
|
|
406
|
+
};
|
|
407
|
+
Object.defineProperty(result, "map", {
|
|
408
|
+
configurable: true,
|
|
409
|
+
enumerable: true,
|
|
410
|
+
get() {
|
|
400
411
|
return ms.generateMap();
|
|
401
412
|
}
|
|
402
|
-
};
|
|
413
|
+
});
|
|
414
|
+
return result;
|
|
403
415
|
}
|
|
404
416
|
|
|
405
417
|
// src/bundlers/vite/query.ts
|
|
@@ -487,7 +499,7 @@ function resolveUniAppXStyleIsolationEnabled(root) {
|
|
|
487
499
|
try {
|
|
488
500
|
const raw = _fs2.default.readFileSync(manifestPath, "utf8");
|
|
489
501
|
const manifest = _commentjson.parse.call(void 0, raw);
|
|
490
|
-
enabled = `${_nullishCoalesce(_optionalChain([manifest, 'access',
|
|
502
|
+
enabled = `${_nullishCoalesce(_optionalChain([manifest, 'access', _24 => _24["uni-app-x"], 'optionalAccess', _25 => _25.styleIsolationVersion]), () => ( ""))}` === "2";
|
|
491
503
|
} catch (e3) {
|
|
492
504
|
enabled = false;
|
|
493
505
|
}
|
|
@@ -502,7 +514,7 @@ var PREPROCESSOR_EXT_RE = /\.(?:scss|sass|less|styl|stylus)(?:\?|$)/i;
|
|
|
502
514
|
var UVUE_NVUE_QUERY_RE = /\.(?:uvue|nvue)(?:\?.*)?$/;
|
|
503
515
|
var UVUE_NVUE_RE2 = /\.(?:uvue|nvue)$/;
|
|
504
516
|
function isPreprocessorRequest(id, lang) {
|
|
505
|
-
const normalizedLang = _optionalChain([lang, 'optionalAccess',
|
|
517
|
+
const normalizedLang = _optionalChain([lang, 'optionalAccess', _26 => _26.toLowerCase, 'call', _27 => _27()]);
|
|
506
518
|
if (normalizedLang && preprocessorLangs.has(normalizedLang)) {
|
|
507
519
|
return true;
|
|
508
520
|
}
|
|
@@ -512,6 +524,9 @@ function isPreprocessorRequest(id, lang) {
|
|
|
512
524
|
}
|
|
513
525
|
return PREPROCESSOR_EXT_RE.test(id);
|
|
514
526
|
}
|
|
527
|
+
function resolveUniAppXCssTarget(id) {
|
|
528
|
+
return UVUE_NVUE_RE2.test(_shared.cleanUrl.call(void 0, id)) ? "uvue" : void 0;
|
|
529
|
+
}
|
|
515
530
|
function createUniAppXPlugins(options) {
|
|
516
531
|
const {
|
|
517
532
|
appType,
|
|
@@ -526,7 +541,7 @@ function createUniAppXPlugins(options) {
|
|
|
526
541
|
getResolvedConfig,
|
|
527
542
|
uniAppX
|
|
528
543
|
} = options;
|
|
529
|
-
const resolvedUniAppXOptions =
|
|
544
|
+
const resolvedUniAppXOptions = _chunkNIS74SI6js.resolveUniAppXOptions.call(void 0, uniAppX);
|
|
530
545
|
const isIosPlatform = _nullishCoalesce(providedIosPlatform, () => ( _chunkDYLQ6UOIjs.resolveUniUtsPlatform.call(void 0, ).isAppIos));
|
|
531
546
|
const cssHandlerOptionsCache = /* @__PURE__ */ new Map();
|
|
532
547
|
let componentLocalStyleEnabled;
|
|
@@ -542,7 +557,7 @@ function createUniAppXPlugins(options) {
|
|
|
542
557
|
if (componentLocalStyleEnabled !== void 0) {
|
|
543
558
|
return componentLocalStyleEnabled;
|
|
544
559
|
}
|
|
545
|
-
const root = _optionalChain([getResolvedConfig, 'call',
|
|
560
|
+
const root = _optionalChain([getResolvedConfig, 'call', _28 => _28(), 'optionalAccess', _29 => _29.root]);
|
|
546
561
|
componentLocalStyleEnabled = resolveUniAppXStyleIsolationEnabled(root);
|
|
547
562
|
return componentLocalStyleEnabled;
|
|
548
563
|
}
|
|
@@ -554,6 +569,8 @@ function createUniAppXPlugins(options) {
|
|
|
554
569
|
if (!styleHandlerOptions) {
|
|
555
570
|
styleHandlerOptions = {
|
|
556
571
|
isMainChunk: mainCssChunkMatcher(id, appType),
|
|
572
|
+
uniAppXCssTarget: resolveUniAppXCssTarget(id),
|
|
573
|
+
uniAppXUnsupported: resolvedUniAppXOptions.uvueUnsupported,
|
|
557
574
|
postcssOptions: {
|
|
558
575
|
options: {
|
|
559
576
|
from: id,
|
|
@@ -570,6 +587,10 @@ function createUniAppXPlugins(options) {
|
|
|
570
587
|
cssHandlerOptionsCache.set(cacheKey, styleHandlerOptions);
|
|
571
588
|
}
|
|
572
589
|
const postcssResult = await styleHandler(code, styleHandlerOptions);
|
|
590
|
+
const warnings = typeof postcssResult.warnings === "function" ? postcssResult.warnings() : [];
|
|
591
|
+
for (const warning of warnings) {
|
|
592
|
+
_chunkNIS74SI6js.logger.warn(warning.toString());
|
|
593
|
+
}
|
|
573
594
|
const rawPostcssMap = postcssResult.map.toJSON();
|
|
574
595
|
const postcssMap = await formatPostcssSourceMap(
|
|
575
596
|
rawPostcssMap,
|
|
@@ -613,9 +634,9 @@ function createUniAppXPlugins(options) {
|
|
|
613
634
|
return;
|
|
614
635
|
}
|
|
615
636
|
const resolvedConfig = getResolvedConfig();
|
|
616
|
-
const isServeCommand = _optionalChain([resolvedConfig, 'optionalAccess',
|
|
617
|
-
const isWatchBuild = _optionalChain([resolvedConfig, 'optionalAccess',
|
|
618
|
-
const isNonWatchBuild = _optionalChain([resolvedConfig, 'optionalAccess',
|
|
637
|
+
const isServeCommand = _optionalChain([resolvedConfig, 'optionalAccess', _30 => _30.command]) === "serve";
|
|
638
|
+
const isWatchBuild = _optionalChain([resolvedConfig, 'optionalAccess', _31 => _31.command]) === "build" && !!_optionalChain([resolvedConfig, 'access', _32 => _32.build, 'optionalAccess', _33 => _33.watch]);
|
|
639
|
+
const isNonWatchBuild = _optionalChain([resolvedConfig, 'optionalAccess', _34 => _34.command]) === "build" && !_optionalChain([resolvedConfig, 'access', _35 => _35.build, 'optionalAccess', _36 => _36.watch]);
|
|
619
640
|
const shouldForceRefresh = isServeCommand || isWatchBuild || isNonWatchBuild;
|
|
620
641
|
const currentRuntimeSet = shouldForceRefresh ? await ensureRuntimeClassSet(true) : await ensureRuntimeClassSet();
|
|
621
642
|
const extraOptions = customAttributesEntities.length > 0 || disabledDefaultTemplateHandler ? {
|
|
@@ -635,7 +656,7 @@ function createUniAppXPlugins(options) {
|
|
|
635
656
|
},
|
|
636
657
|
async handleHotUpdate(ctx) {
|
|
637
658
|
const resolvedConfig = getResolvedConfig();
|
|
638
|
-
if (_optionalChain([resolvedConfig, 'optionalAccess',
|
|
659
|
+
if (_optionalChain([resolvedConfig, 'optionalAccess', _37 => _37.command]) !== "serve") {
|
|
639
660
|
return;
|
|
640
661
|
}
|
|
641
662
|
if (!UVUE_NVUE_RE2.test(ctx.file)) {
|
|
@@ -645,7 +666,7 @@ function createUniAppXPlugins(options) {
|
|
|
645
666
|
},
|
|
646
667
|
async watchChange(id) {
|
|
647
668
|
const resolvedConfig = getResolvedConfig();
|
|
648
|
-
if (_optionalChain([resolvedConfig, 'optionalAccess',
|
|
669
|
+
if (_optionalChain([resolvedConfig, 'optionalAccess', _38 => _38.command]) !== "build" || !_optionalChain([resolvedConfig, 'access', _39 => _39.build, 'optionalAccess', _40 => _40.watch])) {
|
|
649
670
|
return;
|
|
650
671
|
}
|
|
651
672
|
if (!UVUE_NVUE_QUERY_RE.test(id)) {
|
|
@@ -671,7 +692,7 @@ function createUniAppXAssetTask(file, originalSource, outDir, options) {
|
|
|
671
692
|
runtimeSet,
|
|
672
693
|
applyLinkedResults: applyLinkedResults2
|
|
673
694
|
} = options;
|
|
674
|
-
const absoluteFile =
|
|
695
|
+
const absoluteFile = _chunkGMKSBLNYjs.toAbsoluteOutputPath.call(void 0, file, outDir);
|
|
675
696
|
const rawSource = originalSource.source.toString();
|
|
676
697
|
const rawHashSource = options.hashSalt ? `${rawSource}
|
|
677
698
|
/*${options.hashSalt}*/` : rawSource;
|
|
@@ -745,7 +766,7 @@ function isJavaScriptEntry(entry) {
|
|
|
745
766
|
function createBundleModuleGraphOptions(outputDir, entries) {
|
|
746
767
|
return {
|
|
747
768
|
resolve(specifier, importer) {
|
|
748
|
-
return
|
|
769
|
+
return _chunkGMKSBLNYjs.resolveOutputSpecifier.call(void 0, specifier, importer, outputDir, (candidate) => entries.has(candidate));
|
|
749
770
|
},
|
|
750
771
|
load(id) {
|
|
751
772
|
const entry = entries.get(id);
|
|
@@ -777,7 +798,7 @@ function applyLinkedResults(linked, entries, onLinkedUpdate, onApplied) {
|
|
|
777
798
|
} else {
|
|
778
799
|
entry.output.source = code;
|
|
779
800
|
}
|
|
780
|
-
_optionalChain([onApplied, 'optionalCall',
|
|
801
|
+
_optionalChain([onApplied, 'optionalCall', _41 => _41(entry, code)]);
|
|
781
802
|
onLinkedUpdate(entry.fileName, previous, code);
|
|
782
803
|
}
|
|
783
804
|
}
|
|
@@ -819,14 +840,14 @@ function createHtmlRuntimeAffectingSignature(source) {
|
|
|
819
840
|
}
|
|
820
841
|
function createJsRuntimeAffectingSignature(source) {
|
|
821
842
|
try {
|
|
822
|
-
const ast =
|
|
843
|
+
const ast = _chunkYVRX3F6Sjs.babelParse.call(void 0, source, {
|
|
823
844
|
cache: true,
|
|
824
845
|
cacheKey: "vite-runtime-affecting:unambiguous",
|
|
825
846
|
plugins: ["jsx", "typescript"],
|
|
826
847
|
sourceType: "unambiguous"
|
|
827
848
|
});
|
|
828
849
|
const parts = [];
|
|
829
|
-
|
|
850
|
+
_chunkYVRX3F6Sjs.traverse.call(void 0, ast, {
|
|
830
851
|
noScope: true,
|
|
831
852
|
StringLiteral(path7) {
|
|
832
853
|
parts.push(`s:${path7.node.value}`);
|
|
@@ -844,7 +865,7 @@ function createJsRuntimeAffectingSignature(source) {
|
|
|
844
865
|
const comments = ast.comments;
|
|
845
866
|
if (Array.isArray(comments)) {
|
|
846
867
|
for (const comment of comments) {
|
|
847
|
-
if (typeof _optionalChain([comment, 'optionalAccess',
|
|
868
|
+
if (typeof _optionalChain([comment, 'optionalAccess', _42 => _42.value]) === "string" && comment.value.length > 0) {
|
|
848
869
|
parts.push(`c:${comment.value}`);
|
|
849
870
|
}
|
|
850
871
|
}
|
|
@@ -918,7 +939,7 @@ function collectJsEntries(fileName, output, outDir, store) {
|
|
|
918
939
|
if (!isJavaScriptEntry(entry)) {
|
|
919
940
|
return;
|
|
920
941
|
}
|
|
921
|
-
const absolute =
|
|
942
|
+
const absolute = _chunkGMKSBLNYjs.toAbsoluteOutputPath.call(void 0, fileName, outDir);
|
|
922
943
|
store.set(absolute, entry);
|
|
923
944
|
}
|
|
924
945
|
function markProcessFile(type, file, processFiles) {
|
|
@@ -1032,28 +1053,6 @@ function updateBundleBuildState(state, snapshot, linkedByEntry, options = {}) {
|
|
|
1032
1053
|
state.dependentsByLinkedFile = invertLinkedByEntry(state.linkedByEntry);
|
|
1033
1054
|
}
|
|
1034
1055
|
|
|
1035
|
-
// src/bundlers/vite/js-precheck.ts
|
|
1036
|
-
var FAST_JS_TRANSFORM_HINT_RE = /className\b|class\s*=|classList\.|\b(?:twMerge|clsx|classnames|cn|cva)\b|\[["'`]class["'`]\]|text-\[|bg-\[|\b(?:[whpm]|px|py|mx|my|rounded|flex|grid|gap)-/;
|
|
1037
|
-
var DEPENDENCY_HINT_RE = /\bimport\s*[("'`{*]|\brequire\s*\(|\bexport\s+\*\s+from\s+["'`]|\bexport\s*\{[^}]*\}\s*from\s+["'`]/;
|
|
1038
|
-
function shouldSkipViteJsTransform(rawSource, options) {
|
|
1039
|
-
if (!rawSource) {
|
|
1040
|
-
return true;
|
|
1041
|
-
}
|
|
1042
|
-
if (_optionalChain([options, 'optionalAccess', _35 => _35.alwaysEscape])) {
|
|
1043
|
-
return false;
|
|
1044
|
-
}
|
|
1045
|
-
if (_optionalChain([options, 'optionalAccess', _36 => _36.moduleSpecifierReplacements]) && Object.keys(options.moduleSpecifierReplacements).length > 0) {
|
|
1046
|
-
return false;
|
|
1047
|
-
}
|
|
1048
|
-
if (_optionalChain([options, 'optionalAccess', _37 => _37.wrapExpression])) {
|
|
1049
|
-
return false;
|
|
1050
|
-
}
|
|
1051
|
-
if (DEPENDENCY_HINT_RE.test(rawSource)) {
|
|
1052
|
-
return false;
|
|
1053
|
-
}
|
|
1054
|
-
return !FAST_JS_TRANSFORM_HINT_RE.test(rawSource);
|
|
1055
|
-
}
|
|
1056
|
-
|
|
1057
1056
|
// src/bundlers/vite/generate-bundle.ts
|
|
1058
1057
|
function formatDebugFileList(files, limit = 8) {
|
|
1059
1058
|
if (files.size === 0) {
|
|
@@ -1223,10 +1222,10 @@ function createGenerateBundleHook(context) {
|
|
|
1223
1222
|
const debugCssDiff = _process2.default.env.WEAPP_TW_VITE_DEBUG_CSS_DIFF === "1";
|
|
1224
1223
|
const resolvedConfig = getResolvedConfig();
|
|
1225
1224
|
const bundleFiles = Object.keys(bundle);
|
|
1226
|
-
const buildCommand = _optionalChain([resolvedConfig, 'optionalAccess',
|
|
1225
|
+
const buildCommand = _optionalChain([resolvedConfig, 'optionalAccess', _43 => _43.command]) === "build";
|
|
1227
1226
|
const useIncrementalMode = !buildCommand || hasOmittedKnownBundleFiles(bundleFiles, state.sourceHashByFile.keys());
|
|
1228
|
-
const rootDir = _optionalChain([resolvedConfig, 'optionalAccess',
|
|
1229
|
-
const outDir = _optionalChain([resolvedConfig, 'optionalAccess',
|
|
1227
|
+
const rootDir = _optionalChain([resolvedConfig, 'optionalAccess', _44 => _44.root]) ? _path2.default.resolve(resolvedConfig.root) : _process2.default.cwd();
|
|
1228
|
+
const outDir = _optionalChain([resolvedConfig, 'optionalAccess', _45 => _45.build, 'optionalAccess', _46 => _46.outDir]) ? _path2.default.resolve(rootDir, resolvedConfig.build.outDir) : rootDir;
|
|
1230
1229
|
const snapshot = buildBundleSnapshot(bundle, opts, outDir, state, disableDirtyOptimization || !useIncrementalMode);
|
|
1231
1230
|
const useBundleRuntimeClassSet = useIncrementalMode || runtimeState.twPatcher.majorVersion === 4;
|
|
1232
1231
|
const forceRuntimeRefreshBySource = useIncrementalMode && hasRuntimeAffectingSourceChanges(snapshot.runtimeAffectingChangedByType);
|
|
@@ -1281,7 +1280,7 @@ function createGenerateBundleHook(context) {
|
|
|
1281
1280
|
);
|
|
1282
1281
|
}
|
|
1283
1282
|
debug3("get runtimeSet, class count: %d", runtime.size);
|
|
1284
|
-
const runtimeSignature = _nullishCoalesce(
|
|
1283
|
+
const runtimeSignature = _nullishCoalesce(_chunkNIS74SI6js.getRuntimeClassSetSignature.call(void 0, runtimeState.twPatcher), () => ( "runtime:missing"));
|
|
1285
1284
|
const handleLinkedUpdate = (fileName, previous, next) => {
|
|
1286
1285
|
onUpdate(fileName, previous, next);
|
|
1287
1286
|
debug3("js linked handle: %s", fileName);
|
|
@@ -1305,7 +1304,7 @@ function createGenerateBundleHook(context) {
|
|
|
1305
1304
|
tailwindcssMajorVersion: runtimeState.twPatcher.majorVersion,
|
|
1306
1305
|
moduleGraph: moduleGraphOptions,
|
|
1307
1306
|
babelParserOptions: {
|
|
1308
|
-
..._nullishCoalesce(_optionalChain([extra, 'optionalAccess',
|
|
1307
|
+
..._nullishCoalesce(_optionalChain([extra, 'optionalAccess', _47 => _47.babelParserOptions]), () => ( {})),
|
|
1309
1308
|
sourceFilename: absoluteFilename
|
|
1310
1309
|
}
|
|
1311
1310
|
});
|
|
@@ -1469,7 +1468,7 @@ function createGenerateBundleHook(context) {
|
|
|
1469
1468
|
debug3("js cache replay miss, fallback transform: %s", file);
|
|
1470
1469
|
}
|
|
1471
1470
|
const handlerOptions = createHandlerOptions(absoluteFile);
|
|
1472
|
-
if (!disableJsPrecheck &&
|
|
1471
|
+
if (!disableJsPrecheck && _chunkYVRX3F6Sjs.shouldSkipJsTransform.call(void 0, rawSource, handlerOptions)) {
|
|
1473
1472
|
metrics.js.elapsed += measureElapsed(start);
|
|
1474
1473
|
metrics.js.transformed++;
|
|
1475
1474
|
return {
|
|
@@ -1555,7 +1554,7 @@ function createGenerateBundleHook(context) {
|
|
|
1555
1554
|
sourceType: "unambiguous"
|
|
1556
1555
|
}
|
|
1557
1556
|
});
|
|
1558
|
-
if (!disableJsPrecheck &&
|
|
1557
|
+
if (!disableJsPrecheck && _chunkYVRX3F6Sjs.shouldSkipJsTransform.call(void 0, currentSource, precheckOptions)) {
|
|
1559
1558
|
metrics.js.elapsed += measureElapsed(start);
|
|
1560
1559
|
metrics.js.transformed++;
|
|
1561
1560
|
return;
|
|
@@ -1566,7 +1565,7 @@ function createGenerateBundleHook(context) {
|
|
|
1566
1565
|
});
|
|
1567
1566
|
}
|
|
1568
1567
|
}
|
|
1569
|
-
|
|
1568
|
+
_chunkGMKSBLNYjs.pushConcurrentTaskFactories.call(void 0, tasks, jsTaskFactories);
|
|
1570
1569
|
await Promise.all(tasks);
|
|
1571
1570
|
for (const apply of pendingLinkedUpdates) {
|
|
1572
1571
|
apply();
|
|
@@ -1608,8 +1607,8 @@ var _module = require('module');
|
|
|
1608
1607
|
|
|
1609
1608
|
|
|
1610
1609
|
var _tailwindcsspatch = require('tailwindcss-patch');
|
|
1611
|
-
var debug =
|
|
1612
|
-
var require2 = _module.createRequire.call(void 0,
|
|
1610
|
+
var debug = _chunkYVRX3F6Sjs.createDebug.call(void 0, "[vite:runtime-set] ");
|
|
1611
|
+
var require2 = _module.createRequire.call(void 0, _chunkONLKZIRQjs.importMetaUrl);
|
|
1613
1612
|
var EXTENSION_DOT_PREFIX_RE = /^\./;
|
|
1614
1613
|
var VALIDATION_FILE_NAME = "runtime-candidates.html";
|
|
1615
1614
|
var tailwindNodeModulePromise;
|
|
@@ -1626,23 +1625,23 @@ function isPostcssPluginImportTarget(value) {
|
|
|
1626
1625
|
return value === "@tailwindcss/postcss" || value === "@tailwindcss/postcss7-compat" || value.includes("/postcss");
|
|
1627
1626
|
}
|
|
1628
1627
|
function resolveTailwindCssImportTarget(patcher) {
|
|
1629
|
-
const tailwindOptions =
|
|
1630
|
-
const cssEntries = _optionalChain([tailwindOptions, 'optionalAccess',
|
|
1628
|
+
const tailwindOptions = _chunkNIS74SI6js.resolveTailwindcssOptions.call(void 0, patcher.options);
|
|
1629
|
+
const cssEntries = _optionalChain([tailwindOptions, 'optionalAccess', _48 => _48.v4, 'optionalAccess', _49 => _49.cssEntries, 'optionalAccess', _50 => _50.filter, 'call', _51 => _51((item) => typeof item === "string" && item.length > 0)]);
|
|
1631
1630
|
if (cssEntries && cssEntries.length > 0) {
|
|
1632
1631
|
return createCssImportSource(cssEntries);
|
|
1633
1632
|
}
|
|
1634
|
-
const configuredPackageName = _optionalChain([tailwindOptions, 'optionalAccess',
|
|
1633
|
+
const configuredPackageName = _optionalChain([tailwindOptions, 'optionalAccess', _52 => _52.packageName]);
|
|
1635
1634
|
if (typeof configuredPackageName === "string" && configuredPackageName.length > 0 && !isPostcssPluginImportTarget(configuredPackageName)) {
|
|
1636
1635
|
return createCssImportSource([configuredPackageName]);
|
|
1637
1636
|
}
|
|
1638
|
-
const packageName = _optionalChain([patcher, 'access',
|
|
1637
|
+
const packageName = _optionalChain([patcher, 'access', _53 => _53.packageInfo, 'optionalAccess', _54 => _54.name]);
|
|
1639
1638
|
if (typeof packageName === "string" && packageName.length > 0 && !isPostcssPluginImportTarget(packageName)) {
|
|
1640
1639
|
return createCssImportSource([packageName]);
|
|
1641
1640
|
}
|
|
1642
1641
|
return createCssImportSource(["tailwindcss"]);
|
|
1643
1642
|
}
|
|
1644
1643
|
function getProjectRoot(patcher) {
|
|
1645
|
-
return _nullishCoalesce(_optionalChain([patcher, 'access',
|
|
1644
|
+
return _nullishCoalesce(_optionalChain([patcher, 'access', _55 => _55.options, 'optionalAccess', _56 => _56.projectRoot]), () => ( _process2.default.cwd()));
|
|
1646
1645
|
}
|
|
1647
1646
|
async function importTailwindNodeModule() {
|
|
1648
1647
|
if (!tailwindNodeModulePromise) {
|
|
@@ -1669,16 +1668,16 @@ function resolveMaybeAbsolute(base, value) {
|
|
|
1669
1668
|
}
|
|
1670
1669
|
async function resolveTailwindCssSource(patcher) {
|
|
1671
1670
|
const projectRoot = getProjectRoot(patcher);
|
|
1672
|
-
const tailwindOptions =
|
|
1673
|
-
const configuredBase = resolveMaybeAbsolute(projectRoot, _optionalChain([tailwindOptions, 'optionalAccess',
|
|
1674
|
-
const configDir = _optionalChain([tailwindOptions, 'optionalAccess',
|
|
1671
|
+
const tailwindOptions = _chunkNIS74SI6js.resolveTailwindcssOptions.call(void 0, patcher.options);
|
|
1672
|
+
const configuredBase = resolveMaybeAbsolute(projectRoot, _optionalChain([tailwindOptions, 'optionalAccess', _57 => _57.v4, 'optionalAccess', _58 => _58.base]));
|
|
1673
|
+
const configDir = _optionalChain([tailwindOptions, 'optionalAccess', _59 => _59.config]) ? _path2.default.dirname(tailwindOptions.config) : void 0;
|
|
1675
1674
|
const sharedFallbacks = [
|
|
1676
1675
|
configuredBase,
|
|
1677
1676
|
projectRoot,
|
|
1678
|
-
_optionalChain([tailwindOptions, 'optionalAccess',
|
|
1677
|
+
_optionalChain([tailwindOptions, 'optionalAccess', _60 => _60.cwd]),
|
|
1679
1678
|
configDir
|
|
1680
1679
|
].filter((item) => typeof item === "string" && item.length > 0);
|
|
1681
|
-
if (_optionalChain([tailwindOptions, 'optionalAccess',
|
|
1680
|
+
if (_optionalChain([tailwindOptions, 'optionalAccess', _61 => _61.v4, 'optionalAccess', _62 => _62.css])) {
|
|
1682
1681
|
return {
|
|
1683
1682
|
projectRoot,
|
|
1684
1683
|
base: _nullishCoalesce(configuredBase, () => ( projectRoot)),
|
|
@@ -1686,7 +1685,7 @@ async function resolveTailwindCssSource(patcher) {
|
|
|
1686
1685
|
css: tailwindOptions.v4.css
|
|
1687
1686
|
};
|
|
1688
1687
|
}
|
|
1689
|
-
const cssEntries = _nullishCoalesce(_optionalChain([tailwindOptions, 'optionalAccess',
|
|
1688
|
+
const cssEntries = _nullishCoalesce(_optionalChain([tailwindOptions, 'optionalAccess', _63 => _63.v4, 'optionalAccess', _64 => _64.cssEntries, 'optionalAccess', _65 => _65.filter, 'call', _66 => _66((item) => typeof item === "string" && item.length > 0)]), () => ( []));
|
|
1690
1689
|
if (cssEntries.length > 0) {
|
|
1691
1690
|
const resolvedEntries = cssEntries.map((entry) => _nullishCoalesce(resolveMaybeAbsolute(projectRoot, entry), () => ( entry)));
|
|
1692
1691
|
const cssChunks = [];
|
|
@@ -1867,7 +1866,7 @@ function createBundleRuntimeClassSetManager(options = {}) {
|
|
|
1867
1866
|
const matches = await extractRawCandidates(entry.source, resolveEntryExtension(entry));
|
|
1868
1867
|
const candidates = /* @__PURE__ */ new Set();
|
|
1869
1868
|
for (const match of matches) {
|
|
1870
|
-
const candidate = _optionalChain([match, 'optionalAccess',
|
|
1869
|
+
const candidate = _optionalChain([match, 'optionalAccess', _67 => _67.rawCandidate]);
|
|
1871
1870
|
if (typeof candidate === "string" && candidate.length > 0) {
|
|
1872
1871
|
candidates.add(candidate);
|
|
1873
1872
|
}
|
|
@@ -1875,7 +1874,7 @@ function createBundleRuntimeClassSetManager(options = {}) {
|
|
|
1875
1874
|
return candidates;
|
|
1876
1875
|
}
|
|
1877
1876
|
async function sync(patcher, snapshot) {
|
|
1878
|
-
const nextSignature = _nullishCoalesce(
|
|
1877
|
+
const nextSignature = _nullishCoalesce(_chunkNIS74SI6js.getRuntimeClassSetSignature.call(void 0, patcher), () => ( "runtime:missing"));
|
|
1879
1878
|
const runtimeEntries = createRuntimeEntries(snapshot);
|
|
1880
1879
|
const runtimeEntriesByFile = new Map(runtimeEntries.map((entry) => [entry.file, entry]));
|
|
1881
1880
|
const currentRuntimeFiles = new Set(runtimeEntriesByFile.keys());
|
|
@@ -2073,15 +2072,15 @@ function createRewriteCssImportsPlugins(options) {
|
|
|
2073
2072
|
return [];
|
|
2074
2073
|
}
|
|
2075
2074
|
const { appType, getAppType, weappTailwindcssDirPosix: weappTailwindcssDirPosix2 } = options;
|
|
2076
|
-
const resolveAppType = () => _nullishCoalesce(_optionalChain([getAppType, 'optionalCall',
|
|
2075
|
+
const resolveAppType = () => _nullishCoalesce(_optionalChain([getAppType, 'optionalCall', _68 => _68()]), () => ( appType));
|
|
2077
2076
|
return [
|
|
2078
2077
|
{
|
|
2079
|
-
name: `${
|
|
2078
|
+
name: `${_chunkYVRX3F6Sjs.vitePluginName}:rewrite-css-imports`,
|
|
2080
2079
|
enforce: "pre",
|
|
2081
2080
|
resolveId: {
|
|
2082
2081
|
order: "pre",
|
|
2083
2082
|
handler(id, importer) {
|
|
2084
|
-
const replacement =
|
|
2083
|
+
const replacement = _chunkGMKSBLNYjs.resolveTailwindcssImport.call(void 0, id, weappTailwindcssDirPosix2, {
|
|
2085
2084
|
join: joinPosixPath,
|
|
2086
2085
|
appType: resolveAppType()
|
|
2087
2086
|
});
|
|
@@ -2100,7 +2099,7 @@ function createRewriteCssImportsPlugins(options) {
|
|
|
2100
2099
|
if (!isCSSRequest(id)) {
|
|
2101
2100
|
return null;
|
|
2102
2101
|
}
|
|
2103
|
-
const rewritten =
|
|
2102
|
+
const rewritten = _chunkGMKSBLNYjs.rewriteTailwindcssImportsInCode.call(void 0, code, weappTailwindcssDirPosix2, {
|
|
2104
2103
|
join: joinPosixPath,
|
|
2105
2104
|
appType: resolveAppType()
|
|
2106
2105
|
});
|
|
@@ -2118,10 +2117,17 @@ function createRewriteCssImportsPlugins(options) {
|
|
|
2118
2117
|
}
|
|
2119
2118
|
|
|
2120
2119
|
// src/bundlers/vite/index.ts
|
|
2121
|
-
var debug2 =
|
|
2122
|
-
var weappTailwindcssPackageDir =
|
|
2120
|
+
var debug2 = _chunkYVRX3F6Sjs.createDebug.call(void 0, );
|
|
2121
|
+
var weappTailwindcssPackageDir = _chunkGMKSBLNYjs.resolvePackageDir.call(void 0, "weapp-tailwindcss");
|
|
2123
2122
|
var weappTailwindcssDirPosix = slash(weappTailwindcssPackageDir);
|
|
2124
2123
|
var PACKAGE_JSON_FILE2 = "package.json";
|
|
2124
|
+
function getPostcssPluginName(plugin) {
|
|
2125
|
+
if (!plugin || typeof plugin !== "object" || !("postcssPlugin" in plugin)) {
|
|
2126
|
+
return;
|
|
2127
|
+
}
|
|
2128
|
+
const { postcssPlugin } = plugin;
|
|
2129
|
+
return typeof postcssPlugin === "string" ? postcssPlugin : void 0;
|
|
2130
|
+
}
|
|
2125
2131
|
function resolveImplicitTailwindcssBasedirFromViteRoot(root) {
|
|
2126
2132
|
const resolvedRoot = _path2.default.resolve(root);
|
|
2127
2133
|
if (!_fs.existsSync.call(void 0, resolvedRoot)) {
|
|
@@ -2137,11 +2143,11 @@ function resolveImplicitTailwindcssBasedirFromViteRoot(root) {
|
|
|
2137
2143
|
}
|
|
2138
2144
|
current = parent;
|
|
2139
2145
|
}
|
|
2140
|
-
const tailwindConfigPath =
|
|
2146
|
+
const tailwindConfigPath = _chunkNIS74SI6js.findTailwindConfig.call(void 0, searchRoots);
|
|
2141
2147
|
if (tailwindConfigPath) {
|
|
2142
2148
|
return _path2.default.dirname(tailwindConfigPath);
|
|
2143
2149
|
}
|
|
2144
|
-
const packageRoot =
|
|
2150
|
+
const packageRoot = _chunkNIS74SI6js.findNearestPackageRoot.call(void 0, resolvedRoot);
|
|
2145
2151
|
if (packageRoot && _fs.existsSync.call(void 0, _path2.default.join(packageRoot, PACKAGE_JSON_FILE2))) {
|
|
2146
2152
|
return packageRoot;
|
|
2147
2153
|
}
|
|
@@ -2151,7 +2157,7 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
|
|
|
2151
2157
|
const hasExplicitAppType = typeof options.appType === "string" && options.appType.trim().length > 0;
|
|
2152
2158
|
const rewriteCssImportsSpecified = Object.hasOwn(options, "rewriteCssImports");
|
|
2153
2159
|
const hasExplicitTailwindcssBasedir = typeof options.tailwindcssBasedir === "string" && options.tailwindcssBasedir.trim().length > 0;
|
|
2154
|
-
const opts =
|
|
2160
|
+
const opts = _chunkYVRX3F6Sjs.getCompilerContext.call(void 0, options);
|
|
2155
2161
|
const {
|
|
2156
2162
|
disabled,
|
|
2157
2163
|
customAttributes,
|
|
@@ -2164,8 +2170,8 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
|
|
|
2164
2170
|
uniAppX,
|
|
2165
2171
|
disabledDefaultTemplateHandler
|
|
2166
2172
|
} = opts;
|
|
2167
|
-
const uniAppXEnabled =
|
|
2168
|
-
const disabledOptions =
|
|
2173
|
+
const uniAppXEnabled = _chunkNIS74SI6js.isUniAppXEnabled.call(void 0, uniAppX);
|
|
2174
|
+
const disabledOptions = _chunkGMKSBLNYjs.resolveDisabledOptions.call(void 0, disabled);
|
|
2169
2175
|
const tailwindcssMajorVersion = _nullishCoalesce(initialTwPatcher.majorVersion, () => ( 0));
|
|
2170
2176
|
const shouldRewriteCssImports = opts.rewriteCssImports !== false && !disabledOptions.rewriteCssImports && (rewriteCssImportsSpecified || tailwindcssMajorVersion >= 4);
|
|
2171
2177
|
const rewritePlugins = createRewriteCssImportsPlugins({
|
|
@@ -2176,8 +2182,8 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
|
|
|
2176
2182
|
if (disabledOptions.plugin) {
|
|
2177
2183
|
return rewritePlugins.length ? rewritePlugins : void 0;
|
|
2178
2184
|
}
|
|
2179
|
-
const customAttributesEntities =
|
|
2180
|
-
const patchRecorderState =
|
|
2185
|
+
const customAttributesEntities = _chunkYVRX3F6Sjs.toCustomAttributesEntities.call(void 0, customAttributes);
|
|
2186
|
+
const patchRecorderState = _chunkYVRX3F6Sjs.setupPatchRecorder.call(void 0, initialTwPatcher, opts.tailwindcssBasedir, {
|
|
2181
2187
|
source: "runtime",
|
|
2182
2188
|
cwd: _nullishCoalesce(opts.tailwindcssBasedir, () => ( _process2.default.cwd()))
|
|
2183
2189
|
});
|
|
@@ -2194,8 +2200,8 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
|
|
|
2194
2200
|
let runtimeRefreshOptionsKey;
|
|
2195
2201
|
const bundleRuntimeClassSetManager = createBundleRuntimeClassSetManager();
|
|
2196
2202
|
function resolveRuntimeRefreshOptions() {
|
|
2197
|
-
const configPath = _optionalChain([
|
|
2198
|
-
const signature =
|
|
2203
|
+
const configPath = _optionalChain([_chunkNIS74SI6js.resolveTailwindcssOptions.call(void 0, runtimeState.twPatcher.options), 'optionalAccess', _69 => _69.config]);
|
|
2204
|
+
const signature = _chunkNIS74SI6js.getRuntimeClassSetSignature.call(void 0, runtimeState.twPatcher);
|
|
2199
2205
|
const optionsKey = JSON.stringify({
|
|
2200
2206
|
appType: opts.appType,
|
|
2201
2207
|
uniAppX: uniAppXEnabled,
|
|
@@ -2216,7 +2222,7 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
|
|
|
2216
2222
|
async function refreshRuntimeState(force) {
|
|
2217
2223
|
const invalidation = resolveRuntimeRefreshOptions();
|
|
2218
2224
|
const shouldRefresh = force || invalidation.changed;
|
|
2219
|
-
const refreshed = await
|
|
2225
|
+
const refreshed = await _chunkYVRX3F6Sjs.refreshTailwindRuntimeState.call(void 0, runtimeState, {
|
|
2220
2226
|
force: shouldRefresh,
|
|
2221
2227
|
clearCache: force || invalidation.changed
|
|
2222
2228
|
});
|
|
@@ -2237,7 +2243,7 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
|
|
|
2237
2243
|
}
|
|
2238
2244
|
if (forceRuntimeRefresh || !runtimeSetPromise) {
|
|
2239
2245
|
const invalidation = resolveRuntimeRefreshOptions();
|
|
2240
|
-
const task2 =
|
|
2246
|
+
const task2 = _chunkYVRX3F6Sjs.collectRuntimeClassSet.call(void 0, runtimeState.twPatcher, {
|
|
2241
2247
|
force: forceRuntimeRefresh || invalidation.changed,
|
|
2242
2248
|
skipRefresh: forceRuntimeRefresh,
|
|
2243
2249
|
clearCache: forceRuntimeRefresh || invalidation.changed
|
|
@@ -2279,7 +2285,7 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
|
|
|
2279
2285
|
if (!forceRuntimeRefresh && !invalidation.changed && !forceCollectBySource && runtimeSet) {
|
|
2280
2286
|
return runtimeSet;
|
|
2281
2287
|
}
|
|
2282
|
-
const task =
|
|
2288
|
+
const task = _chunkYVRX3F6Sjs.collectRuntimeClassSet.call(void 0, runtimeState.twPatcher, {
|
|
2283
2289
|
force: forceRuntimeRefresh || invalidation.changed || forceCollectBySource,
|
|
2284
2290
|
skipRefresh: forceRuntimeRefresh,
|
|
2285
2291
|
clearCache: forceRuntimeRefresh || invalidation.changed
|
|
@@ -2314,7 +2320,7 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
|
|
|
2314
2320
|
const plugins = [
|
|
2315
2321
|
...rewritePlugins,
|
|
2316
2322
|
{
|
|
2317
|
-
name: `${
|
|
2323
|
+
name: `${_chunkYVRX3F6Sjs.vitePluginName}:post`,
|
|
2318
2324
|
enforce: "post",
|
|
2319
2325
|
async configResolved(config) {
|
|
2320
2326
|
resolvedConfig = config;
|
|
@@ -2352,24 +2358,24 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
|
|
|
2352
2358
|
}
|
|
2353
2359
|
if (typeof config.css.postcss === "object" && Array.isArray(config.css.postcss.plugins)) {
|
|
2354
2360
|
const postcssPlugins = config.css.postcss.plugins;
|
|
2355
|
-
const idx = postcssPlugins.findIndex((x) => (
|
|
2356
|
-
// @ts-ignore
|
|
2357
|
-
x.postcssPlugin === "postcss-html-transform"
|
|
2358
|
-
));
|
|
2361
|
+
const idx = postcssPlugins.findIndex((x) => getPostcssPluginName(x) === "postcss-html-transform");
|
|
2359
2362
|
if (idx > -1) {
|
|
2360
2363
|
postcssPlugins.splice(idx, 1, _htmltransform2.default.call(void 0, ));
|
|
2361
2364
|
debug2("remove postcss-html-transform plugin from vite config");
|
|
2362
2365
|
}
|
|
2363
2366
|
}
|
|
2364
2367
|
},
|
|
2365
|
-
generateBundle:
|
|
2366
|
-
|
|
2367
|
-
|
|
2368
|
-
|
|
2369
|
-
|
|
2370
|
-
|
|
2371
|
-
|
|
2372
|
-
|
|
2368
|
+
generateBundle: {
|
|
2369
|
+
order: "post",
|
|
2370
|
+
handler: createGenerateBundleHook({
|
|
2371
|
+
opts,
|
|
2372
|
+
runtimeState,
|
|
2373
|
+
ensureRuntimeClassSet,
|
|
2374
|
+
ensureBundleRuntimeClassSet,
|
|
2375
|
+
debug: debug2,
|
|
2376
|
+
getResolvedConfig
|
|
2377
|
+
})
|
|
2378
|
+
}
|
|
2373
2379
|
}
|
|
2374
2380
|
];
|
|
2375
2381
|
if (uniAppXPlugins) {
|