weapp-tailwindcss 4.12.0-next.0 → 4.12.0
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/bin/weapp-tailwindcss.js +21 -1
- package/dist/{chunk-GMKSBLNY.js → chunk-24AGZQVR.js} +15 -7
- package/dist/{chunk-F2CKKG6Q.mjs → chunk-3VQKDHGP.mjs} +12 -4
- package/dist/{chunk-F5XJWJYO.mjs → chunk-57SOQCAU.mjs} +5 -5
- package/dist/{chunk-GD4SQMVF.mjs → chunk-5ZYHNDEK.mjs} +98 -37
- package/dist/{chunk-FMK6SFQQ.js → chunk-DUHYLR2R.js} +7 -7
- package/dist/{chunk-OYSABARD.js → chunk-E7I5TW5K.js} +3 -2
- package/dist/{chunk-WSS26HZS.js → chunk-FS2NOOEB.js} +5 -5
- package/dist/{chunk-GC7WXUOW.js → chunk-HVNGIKLS.js} +55 -31
- package/dist/{chunk-LVSUBDJC.js → chunk-JZQBZHN5.js} +39 -39
- package/dist/{chunk-QNRJCEZN.mjs → chunk-KGTVD4EP.mjs} +66 -42
- package/dist/{chunk-HL3US2OT.mjs → chunk-NNOQDMUP.mjs} +1 -1
- package/dist/{chunk-5ONE75V7.js → chunk-OFB2KBRP.js} +175 -114
- package/dist/{chunk-AYJ4HLWZ.mjs → chunk-PCDYXXSK.mjs} +11 -4
- package/dist/{chunk-ONLKZIRQ.js → chunk-RKISS72P.js} +1 -1
- package/dist/{chunk-ZR3KN3FG.mjs → chunk-RRQZL7FQ.mjs} +2 -2
- package/dist/{chunk-UUJWDME4.mjs → chunk-XZP3MREK.mjs} +1 -1
- package/dist/{chunk-NIS74SI6.js → chunk-ZAA5ZG3D.js} +60 -53
- package/dist/{chunk-2LH6PZH3.mjs → chunk-ZCH4YINE.mjs} +3 -2
- package/dist/cli.js +2241 -169
- package/dist/cli.mjs +2246 -174
- package/dist/core.js +9 -9
- package/dist/core.mjs +3 -3
- 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.js +1 -1
- package/dist/defaults.mjs +1 -1
- package/dist/gulp.js +5 -5
- package/dist/gulp.mjs +4 -4
- package/dist/index.js +9 -9
- package/dist/index.mjs +8 -8
- package/dist/postcss-html-transform.js +1 -1
- package/dist/postcss-html-transform.mjs +1 -1
- package/dist/presets.js +6 -6
- package/dist/presets.mjs +2 -2
- package/dist/reset.js +1 -1
- package/dist/reset.mjs +1 -1
- package/dist/types.js +1 -1
- package/dist/types.mjs +1 -1
- package/dist/vite.js +6 -6
- package/dist/vite.mjs +5 -5
- package/dist/weapp-tw-css-import-rewrite-loader.js +10 -5
- package/dist/weapp-tw-runtime-classset-loader.js +9 -4
- package/dist/webpack.js +7 -7
- package/dist/webpack.mjs +6 -6
- package/dist/webpack4.js +59 -55
- package/dist/webpack4.mjs +28 -24
- package/package.json +11 -10
- package/scripts/postinstall.mjs +59 -0
|
@@ -6,7 +6,8 @@
|
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
|
|
10
|
+
var _chunk24AGZQVRjs = require('./chunk-24AGZQVR.js');
|
|
10
11
|
|
|
11
12
|
|
|
12
13
|
var _chunkOF6MFURRjs = require('./chunk-OF6MFURR.js');
|
|
@@ -27,7 +28,7 @@ var _chunkOF6MFURRjs = require('./chunk-OF6MFURR.js');
|
|
|
27
28
|
|
|
28
29
|
|
|
29
30
|
|
|
30
|
-
var
|
|
31
|
+
var _chunkHVNGIKLSjs = require('./chunk-HVNGIKLS.js');
|
|
31
32
|
|
|
32
33
|
|
|
33
34
|
|
|
@@ -36,13 +37,13 @@ var _chunkGC7WXUOWjs = require('./chunk-GC7WXUOW.js');
|
|
|
36
37
|
|
|
37
38
|
|
|
38
39
|
|
|
39
|
-
var
|
|
40
|
+
var _chunkZAA5ZG3Djs = require('./chunk-ZAA5ZG3D.js');
|
|
40
41
|
|
|
41
42
|
|
|
42
43
|
var _chunkDYLQ6UOIjs = require('./chunk-DYLQ6UOI.js');
|
|
43
44
|
|
|
44
45
|
|
|
45
|
-
var
|
|
46
|
+
var _chunkRKISS72Pjs = require('./chunk-RKISS72P.js');
|
|
46
47
|
|
|
47
48
|
// src/bundlers/vite/index.ts
|
|
48
49
|
var _fs = require('fs'); var _fs2 = _interopRequireDefault(_fs);
|
|
@@ -81,7 +82,7 @@ function extractLiteralValue(path7) {
|
|
|
81
82
|
}
|
|
82
83
|
return {
|
|
83
84
|
allowDoubleQuotes,
|
|
84
|
-
literal: path7.node.value.raw,
|
|
85
|
+
literal: typeof path7.node.value === "string" ? path7.node.value : path7.node.value.raw,
|
|
85
86
|
offset: 0
|
|
86
87
|
};
|
|
87
88
|
}
|
|
@@ -92,7 +93,7 @@ function isRuntimeCandidate(candidate, runtimeSet) {
|
|
|
92
93
|
if (!runtimeSet || runtimeSet.size === 0) {
|
|
93
94
|
return false;
|
|
94
95
|
}
|
|
95
|
-
return runtimeSet.has(candidate) || runtimeSet.has(
|
|
96
|
+
return runtimeSet.has(candidate) || runtimeSet.has(_chunkHVNGIKLSjs.replaceWxml.call(void 0, candidate));
|
|
96
97
|
}
|
|
97
98
|
function shouldEnableComponentLocalStyle(id) {
|
|
98
99
|
return COMPONENT_RE.test(id);
|
|
@@ -112,7 +113,7 @@ var UniAppXComponentLocalStyleCollector = class {
|
|
|
112
113
|
const alias = createAlias(this.fileId, utility, this.aliasByUtility.size);
|
|
113
114
|
this.aliasByUtility.set(utility, alias);
|
|
114
115
|
this.aliasByLookup.set(utility, alias);
|
|
115
|
-
this.aliasByLookup.set(
|
|
116
|
+
this.aliasByLookup.set(_chunkHVNGIKLSjs.replaceWxml.call(void 0, utility), alias);
|
|
116
117
|
return alias;
|
|
117
118
|
}
|
|
118
119
|
rewriteLiteral(literal, shouldInclude) {
|
|
@@ -135,15 +136,15 @@ var UniAppXComponentLocalStyleCollector = class {
|
|
|
135
136
|
collectRuntimeClasses(rawSource, options = {}) {
|
|
136
137
|
const wrapped = options.wrapExpression ? `${EXPRESSION_WRAPPER_PREFIX}${rawSource}${EXPRESSION_WRAPPER_SUFFIX}` : rawSource;
|
|
137
138
|
try {
|
|
138
|
-
const ast =
|
|
139
|
+
const ast = _chunkHVNGIKLSjs.babelParse.call(void 0, wrapped, {
|
|
139
140
|
plugins: ["typescript"],
|
|
140
141
|
sourceType: options.wrapExpression ? "module" : "unambiguous"
|
|
141
142
|
});
|
|
142
|
-
const analysis =
|
|
143
|
+
const analysis = _chunkHVNGIKLSjs.analyzeSource.call(void 0, ast, {}, void 0, false);
|
|
143
144
|
for (const path7 of analysis.targetPaths) {
|
|
144
145
|
const { literal, allowDoubleQuotes } = extractLiteralValue(path7);
|
|
145
146
|
const candidates = _extractors.splitCode.call(void 0, literal, allowDoubleQuotes);
|
|
146
|
-
const classContext = options.wrapExpression ||
|
|
147
|
+
const classContext = options.wrapExpression || _chunkHVNGIKLSjs.isClassContextLiteralPath.call(void 0, path7);
|
|
147
148
|
for (const candidate of candidates) {
|
|
148
149
|
if (!candidate || !classContext && !isRuntimeCandidate(candidate, this.runtimeSet)) {
|
|
149
150
|
continue;
|
|
@@ -162,15 +163,15 @@ var UniAppXComponentLocalStyleCollector = class {
|
|
|
162
163
|
}
|
|
163
164
|
const wrapped = options.wrapExpression ? `${EXPRESSION_WRAPPER_PREFIX}${rawSource}${EXPRESSION_WRAPPER_SUFFIX}` : rawSource;
|
|
164
165
|
try {
|
|
165
|
-
const ast =
|
|
166
|
+
const ast = _chunkHVNGIKLSjs.babelParse.call(void 0, wrapped, {
|
|
166
167
|
plugins: ["typescript"],
|
|
167
168
|
sourceType: options.wrapExpression ? "module" : "unambiguous"
|
|
168
169
|
});
|
|
169
|
-
const analysis =
|
|
170
|
+
const analysis = _chunkHVNGIKLSjs.analyzeSource.call(void 0, ast, {}, void 0, false);
|
|
170
171
|
if (analysis.targetPaths.length === 0) {
|
|
171
172
|
return rawSource;
|
|
172
173
|
}
|
|
173
|
-
const updater = new (0,
|
|
174
|
+
const updater = new (0, _chunkHVNGIKLSjs.JsTokenUpdater)();
|
|
174
175
|
for (const path7 of analysis.targetPaths) {
|
|
175
176
|
const { literal, allowDoubleQuotes, offset } = extractLiteralValue(path7);
|
|
176
177
|
const candidates = _extractors.splitCode.call(void 0, literal, allowDoubleQuotes);
|
|
@@ -251,7 +252,7 @@ function updateStaticAttribute(ms, prop, content = _optionalChain([prop, 'access
|
|
|
251
252
|
const start = prop.value.loc.start.offset + 1;
|
|
252
253
|
const end = prop.value.loc.end.offset - 1;
|
|
253
254
|
if (start < end) {
|
|
254
|
-
ms.update(start, end,
|
|
255
|
+
ms.update(start, end, _chunkHVNGIKLSjs.replaceWxml.call(void 0, _nullishCoalesce(content, () => ( ""))));
|
|
255
256
|
}
|
|
256
257
|
}
|
|
257
258
|
function updateStaticAttributeWithLocalStyle(ms, prop, collector, content = _optionalChain([prop, 'access', _3 => _3.value, 'optionalAccess', _4 => _4.content])) {
|
|
@@ -264,26 +265,28 @@ function updateStaticAttributeWithLocalStyle(ms, prop, collector, content = _opt
|
|
|
264
265
|
ms.update(start, end, collector.collectAndRewriteStaticClass(_nullishCoalesce(content, () => ( ""))));
|
|
265
266
|
}
|
|
266
267
|
}
|
|
267
|
-
function updateDirectiveExpression(ms, prop, jsHandler, runtimeSet
|
|
268
|
-
if (_optionalChain([prop, 'access',
|
|
268
|
+
function updateDirectiveExpression(ms, prop, jsHandler, runtimeSet) {
|
|
269
|
+
if (_optionalChain([prop, 'access', _5 => _5.exp, 'optionalAccess', _6 => _6.type]) !== _compilerdom.NodeTypes.SIMPLE_EXPRESSION) {
|
|
269
270
|
return;
|
|
270
271
|
}
|
|
272
|
+
const expression = prop.exp.content;
|
|
271
273
|
const start = prop.exp.loc.start.offset;
|
|
272
274
|
const end = prop.exp.loc.end.offset;
|
|
273
275
|
if (start >= end) {
|
|
274
276
|
return;
|
|
275
277
|
}
|
|
276
|
-
const generated =
|
|
278
|
+
const generated = _chunkHVNGIKLSjs.generateCode.call(void 0, expression, {
|
|
277
279
|
jsHandler,
|
|
278
280
|
runtimeSet,
|
|
279
281
|
wrapExpression: true
|
|
280
282
|
});
|
|
281
283
|
ms.update(start, end, generated);
|
|
282
284
|
}
|
|
283
|
-
function updateDirectiveExpressionWithLocalStyle(ms, prop, jsHandler, collector, runtimeSet
|
|
284
|
-
if (_optionalChain([prop, 'access',
|
|
285
|
+
function updateDirectiveExpressionWithLocalStyle(ms, prop, jsHandler, collector, runtimeSet) {
|
|
286
|
+
if (_optionalChain([prop, 'access', _7 => _7.exp, 'optionalAccess', _8 => _8.type]) !== _compilerdom.NodeTypes.SIMPLE_EXPRESSION) {
|
|
285
287
|
return;
|
|
286
288
|
}
|
|
289
|
+
const expression = prop.exp.content;
|
|
287
290
|
const start = prop.exp.loc.start.offset;
|
|
288
291
|
const end = prop.exp.loc.end.offset;
|
|
289
292
|
if (start >= end) {
|
|
@@ -292,7 +295,7 @@ function updateDirectiveExpressionWithLocalStyle(ms, prop, jsHandler, collector,
|
|
|
292
295
|
collector.collectRuntimeClasses(expression, {
|
|
293
296
|
wrapExpression: true
|
|
294
297
|
});
|
|
295
|
-
const generated =
|
|
298
|
+
const generated = _chunkHVNGIKLSjs.generateCode.call(void 0, expression, {
|
|
296
299
|
jsHandler,
|
|
297
300
|
runtimeSet,
|
|
298
301
|
wrapExpression: true
|
|
@@ -302,7 +305,7 @@ function updateDirectiveExpressionWithLocalStyle(ms, prop, jsHandler, collector,
|
|
|
302
305
|
function shouldHandleAttribute(tag, attrName, disabledDefaultTemplateHandler, matchCustomAttribute) {
|
|
303
306
|
const lowerName = attrName.toLowerCase();
|
|
304
307
|
const shouldHandleDefault = !disabledDefaultTemplateHandler && lowerName === "class";
|
|
305
|
-
const shouldHandleCustom = _nullishCoalesce(_optionalChain([matchCustomAttribute, 'optionalCall',
|
|
308
|
+
const shouldHandleCustom = _nullishCoalesce(_optionalChain([matchCustomAttribute, 'optionalCall', _9 => _9(tag, attrName)]), () => ( false));
|
|
306
309
|
return {
|
|
307
310
|
shouldHandleDefault,
|
|
308
311
|
shouldHandleCustom,
|
|
@@ -322,12 +325,12 @@ function transformUVue(code, id, jsHandler, runtimeSet, options = {}) {
|
|
|
322
325
|
return;
|
|
323
326
|
}
|
|
324
327
|
const { customAttributesEntities, disabledDefaultTemplateHandler = false } = options;
|
|
325
|
-
const matchCustomAttribute =
|
|
328
|
+
const matchCustomAttribute = _chunkHVNGIKLSjs.createAttributeMatcher.call(void 0, customAttributesEntities);
|
|
326
329
|
const ms = new (0, _magicstring2.default)(code);
|
|
327
330
|
const { descriptor, errors } = _compilersfc.parse.call(void 0, code);
|
|
328
331
|
const localStyleCollector = options.enableComponentLocalStyle && shouldEnableComponentLocalStyle(id) ? new UniAppXComponentLocalStyleCollector(id, runtimeSet) : void 0;
|
|
329
332
|
if (errors.length === 0) {
|
|
330
|
-
if (_optionalChain([descriptor, 'access',
|
|
333
|
+
if (_optionalChain([descriptor, 'access', _10 => _10.template, 'optionalAccess', _11 => _11.ast])) {
|
|
331
334
|
traverse2(descriptor.template.ast, (node) => {
|
|
332
335
|
if (node.type !== _compilerdom.NodeTypes.ELEMENT) {
|
|
333
336
|
return;
|
|
@@ -352,7 +355,7 @@ function transformUVue(code, id, jsHandler, runtimeSet, options = {}) {
|
|
|
352
355
|
if (shouldHandleDefault) {
|
|
353
356
|
continue;
|
|
354
357
|
}
|
|
355
|
-
} else if (prop.type === _compilerdom.NodeTypes.DIRECTIVE && prop.name === "bind" && _optionalChain([prop, 'access',
|
|
358
|
+
} else if (prop.type === _compilerdom.NodeTypes.DIRECTIVE && prop.name === "bind" && _optionalChain([prop, 'access', _12 => _12.arg, 'optionalAccess', _13 => _13.type]) === _compilerdom.NodeTypes.SIMPLE_EXPRESSION && prop.arg.isStatic) {
|
|
356
359
|
const attrName = prop.arg.content;
|
|
357
360
|
const { shouldHandle } = shouldHandleAttribute(
|
|
358
361
|
tag,
|
|
@@ -379,7 +382,7 @@ function transformUVue(code, id, jsHandler, runtimeSet, options = {}) {
|
|
|
379
382
|
});
|
|
380
383
|
}
|
|
381
384
|
if (descriptor.script) {
|
|
382
|
-
_optionalChain([localStyleCollector, 'optionalAccess',
|
|
385
|
+
_optionalChain([localStyleCollector, 'optionalAccess', _14 => _14.collectRuntimeClasses, 'call', _15 => _15(descriptor.script.content)]);
|
|
383
386
|
const { code: code2 } = jsHandler(descriptor.script.content, _nullishCoalesce(runtimeSet, () => ( /* @__PURE__ */ new Set())), defaultCreateJsHandlerOptions);
|
|
384
387
|
ms.update(
|
|
385
388
|
descriptor.script.loc.start.offset,
|
|
@@ -388,7 +391,7 @@ function transformUVue(code, id, jsHandler, runtimeSet, options = {}) {
|
|
|
388
391
|
);
|
|
389
392
|
}
|
|
390
393
|
if (descriptor.scriptSetup) {
|
|
391
|
-
_optionalChain([localStyleCollector, 'optionalAccess',
|
|
394
|
+
_optionalChain([localStyleCollector, 'optionalAccess', _16 => _16.collectRuntimeClasses, 'call', _17 => _17(descriptor.scriptSetup.content)]);
|
|
392
395
|
const { code: code2 } = jsHandler(descriptor.scriptSetup.content, _nullishCoalesce(runtimeSet, () => ( /* @__PURE__ */ new Set())), defaultCreateJsHandlerOptions);
|
|
393
396
|
ms.update(
|
|
394
397
|
descriptor.scriptSetup.loc.start.offset,
|
|
@@ -396,18 +399,23 @@ function transformUVue(code, id, jsHandler, runtimeSet, options = {}) {
|
|
|
396
399
|
localStyleCollector ? localStyleCollector.rewriteTransformedCode(code2) : code2
|
|
397
400
|
);
|
|
398
401
|
}
|
|
399
|
-
if (_optionalChain([localStyleCollector, 'optionalAccess',
|
|
402
|
+
if (_optionalChain([localStyleCollector, 'optionalAccess', _18 => _18.hasStyles, 'call', _19 => _19()])) {
|
|
400
403
|
ms.append(`
|
|
401
404
|
${localStyleCollector.toStyleBlock()}`);
|
|
402
405
|
}
|
|
403
406
|
}
|
|
404
|
-
|
|
407
|
+
const result = {
|
|
405
408
|
code: ms.toString(),
|
|
406
|
-
|
|
407
|
-
|
|
409
|
+
map: null
|
|
410
|
+
};
|
|
411
|
+
Object.defineProperty(result, "map", {
|
|
412
|
+
configurable: true,
|
|
413
|
+
enumerable: true,
|
|
414
|
+
get() {
|
|
408
415
|
return ms.generateMap();
|
|
409
416
|
}
|
|
410
|
-
};
|
|
417
|
+
});
|
|
418
|
+
return result;
|
|
411
419
|
}
|
|
412
420
|
|
|
413
421
|
// src/bundlers/vite/query.ts
|
|
@@ -495,7 +503,7 @@ function resolveUniAppXStyleIsolationEnabled(root) {
|
|
|
495
503
|
try {
|
|
496
504
|
const raw = _fs2.default.readFileSync(manifestPath, "utf8");
|
|
497
505
|
const manifest = _commentjson.parse.call(void 0, raw);
|
|
498
|
-
enabled = `${_nullishCoalesce(_optionalChain([manifest, 'access',
|
|
506
|
+
enabled = `${_nullishCoalesce(_optionalChain([manifest, 'access', _20 => _20["uni-app-x"], 'optionalAccess', _21 => _21.styleIsolationVersion]), () => ( ""))}` === "2";
|
|
499
507
|
} catch (e3) {
|
|
500
508
|
enabled = false;
|
|
501
509
|
}
|
|
@@ -510,7 +518,7 @@ var PREPROCESSOR_EXT_RE = /\.(?:scss|sass|less|styl|stylus)(?:\?|$)/i;
|
|
|
510
518
|
var UVUE_NVUE_QUERY_RE = /\.(?:uvue|nvue)(?:\?.*)?$/;
|
|
511
519
|
var UVUE_NVUE_RE2 = /\.(?:uvue|nvue)$/;
|
|
512
520
|
function isPreprocessorRequest(id, lang) {
|
|
513
|
-
const normalizedLang = _optionalChain([lang, 'optionalAccess',
|
|
521
|
+
const normalizedLang = _optionalChain([lang, 'optionalAccess', _22 => _22.toLowerCase, 'call', _23 => _23()]);
|
|
514
522
|
if (normalizedLang && preprocessorLangs.has(normalizedLang)) {
|
|
515
523
|
return true;
|
|
516
524
|
}
|
|
@@ -523,6 +531,9 @@ function isPreprocessorRequest(id, lang) {
|
|
|
523
531
|
function resolveUniAppXCssTarget(id) {
|
|
524
532
|
return UVUE_NVUE_RE2.test(_shared.cleanUrl.call(void 0, id)) ? "uvue" : void 0;
|
|
525
533
|
}
|
|
534
|
+
function resolveUniAppXJsTransformEnabled(uniAppX) {
|
|
535
|
+
return uniAppX === void 0 ? true : _chunkZAA5ZG3Djs.isUniAppXEnabled.call(void 0, uniAppX);
|
|
536
|
+
}
|
|
526
537
|
function createUniAppXPlugins(options) {
|
|
527
538
|
const {
|
|
528
539
|
appType,
|
|
@@ -537,7 +548,7 @@ function createUniAppXPlugins(options) {
|
|
|
537
548
|
getResolvedConfig,
|
|
538
549
|
uniAppX
|
|
539
550
|
} = options;
|
|
540
|
-
const resolvedUniAppXOptions =
|
|
551
|
+
const resolvedUniAppXOptions = _chunkZAA5ZG3Djs.resolveUniAppXOptions.call(void 0, uniAppX);
|
|
541
552
|
const isIosPlatform = _nullishCoalesce(providedIosPlatform, () => ( _chunkDYLQ6UOIjs.resolveUniUtsPlatform.call(void 0, ).isAppIos));
|
|
542
553
|
const cssHandlerOptionsCache = /* @__PURE__ */ new Map();
|
|
543
554
|
let componentLocalStyleEnabled;
|
|
@@ -553,7 +564,7 @@ function createUniAppXPlugins(options) {
|
|
|
553
564
|
if (componentLocalStyleEnabled !== void 0) {
|
|
554
565
|
return componentLocalStyleEnabled;
|
|
555
566
|
}
|
|
556
|
-
const root = _optionalChain([getResolvedConfig, 'call',
|
|
567
|
+
const root = _optionalChain([getResolvedConfig, 'call', _24 => _24(), 'optionalAccess', _25 => _25.root]);
|
|
557
568
|
componentLocalStyleEnabled = resolveUniAppXStyleIsolationEnabled(root);
|
|
558
569
|
return componentLocalStyleEnabled;
|
|
559
570
|
}
|
|
@@ -585,7 +596,7 @@ function createUniAppXPlugins(options) {
|
|
|
585
596
|
const postcssResult = await styleHandler(code, styleHandlerOptions);
|
|
586
597
|
const warnings = typeof postcssResult.warnings === "function" ? postcssResult.warnings() : [];
|
|
587
598
|
for (const warning of warnings) {
|
|
588
|
-
|
|
599
|
+
_chunkZAA5ZG3Djs.logger.warn(warning.toString());
|
|
589
600
|
}
|
|
590
601
|
const rawPostcssMap = postcssResult.map.toJSON();
|
|
591
602
|
const postcssMap = await formatPostcssSourceMap(
|
|
@@ -630,9 +641,9 @@ function createUniAppXPlugins(options) {
|
|
|
630
641
|
return;
|
|
631
642
|
}
|
|
632
643
|
const resolvedConfig = getResolvedConfig();
|
|
633
|
-
const isServeCommand = _optionalChain([resolvedConfig, 'optionalAccess',
|
|
634
|
-
const isWatchBuild = _optionalChain([resolvedConfig, 'optionalAccess',
|
|
635
|
-
const isNonWatchBuild = _optionalChain([resolvedConfig, 'optionalAccess',
|
|
644
|
+
const isServeCommand = _optionalChain([resolvedConfig, 'optionalAccess', _26 => _26.command]) === "serve";
|
|
645
|
+
const isWatchBuild = _optionalChain([resolvedConfig, 'optionalAccess', _27 => _27.command]) === "build" && !!_optionalChain([resolvedConfig, 'access', _28 => _28.build, 'optionalAccess', _29 => _29.watch]);
|
|
646
|
+
const isNonWatchBuild = _optionalChain([resolvedConfig, 'optionalAccess', _30 => _30.command]) === "build" && !_optionalChain([resolvedConfig, 'access', _31 => _31.build, 'optionalAccess', _32 => _32.watch]);
|
|
636
647
|
const shouldForceRefresh = isServeCommand || isWatchBuild || isNonWatchBuild;
|
|
637
648
|
const currentRuntimeSet = shouldForceRefresh ? await ensureRuntimeClassSet(true) : await ensureRuntimeClassSet();
|
|
638
649
|
const extraOptions = customAttributesEntities.length > 0 || disabledDefaultTemplateHandler ? {
|
|
@@ -652,7 +663,7 @@ function createUniAppXPlugins(options) {
|
|
|
652
663
|
},
|
|
653
664
|
async handleHotUpdate(ctx) {
|
|
654
665
|
const resolvedConfig = getResolvedConfig();
|
|
655
|
-
if (_optionalChain([resolvedConfig, 'optionalAccess',
|
|
666
|
+
if (_optionalChain([resolvedConfig, 'optionalAccess', _33 => _33.command]) !== "serve") {
|
|
656
667
|
return;
|
|
657
668
|
}
|
|
658
669
|
if (!UVUE_NVUE_RE2.test(ctx.file)) {
|
|
@@ -662,7 +673,7 @@ function createUniAppXPlugins(options) {
|
|
|
662
673
|
},
|
|
663
674
|
async watchChange(id) {
|
|
664
675
|
const resolvedConfig = getResolvedConfig();
|
|
665
|
-
if (_optionalChain([resolvedConfig, 'optionalAccess',
|
|
676
|
+
if (_optionalChain([resolvedConfig, 'optionalAccess', _34 => _34.command]) !== "build" || !_optionalChain([resolvedConfig, 'access', _35 => _35.build, 'optionalAccess', _36 => _36.watch])) {
|
|
666
677
|
return;
|
|
667
678
|
}
|
|
668
679
|
if (!UVUE_NVUE_QUERY_RE.test(id)) {
|
|
@@ -688,7 +699,7 @@ function createUniAppXAssetTask(file, originalSource, outDir, options) {
|
|
|
688
699
|
runtimeSet,
|
|
689
700
|
applyLinkedResults: applyLinkedResults2
|
|
690
701
|
} = options;
|
|
691
|
-
const absoluteFile =
|
|
702
|
+
const absoluteFile = _chunk24AGZQVRjs.toAbsoluteOutputPath.call(void 0, file, outDir);
|
|
692
703
|
const rawSource = originalSource.source.toString();
|
|
693
704
|
const rawHashSource = options.hashSalt ? `${rawSource}
|
|
694
705
|
/*${options.hashSalt}*/` : rawSource;
|
|
@@ -706,7 +717,7 @@ function createUniAppXAssetTask(file, originalSource, outDir, options) {
|
|
|
706
717
|
async transform() {
|
|
707
718
|
const currentSource = originalSource.source.toString();
|
|
708
719
|
const { code, linked } = await jsHandler(currentSource, runtimeSet, createHandlerOptions(absoluteFile, {
|
|
709
|
-
uniAppX:
|
|
720
|
+
uniAppX: resolveUniAppXJsTransformEnabled(options.uniAppX),
|
|
710
721
|
babelParserOptions: {
|
|
711
722
|
plugins: [
|
|
712
723
|
"typescript"
|
|
@@ -760,19 +771,24 @@ function isJavaScriptEntry(entry) {
|
|
|
760
771
|
return entry.fileName.endsWith(".js");
|
|
761
772
|
}
|
|
762
773
|
function createBundleModuleGraphOptions(outputDir, entries) {
|
|
774
|
+
const normalizedEntries = /* @__PURE__ */ new Map();
|
|
775
|
+
for (const [id, entry] of entries) {
|
|
776
|
+
normalizedEntries.set(_chunk24AGZQVRjs.normalizeOutputPathKey.call(void 0, id), entry);
|
|
777
|
+
}
|
|
778
|
+
const getEntry = (id) => _nullishCoalesce(entries.get(id), () => ( normalizedEntries.get(_chunk24AGZQVRjs.normalizeOutputPathKey.call(void 0, id))));
|
|
763
779
|
return {
|
|
764
780
|
resolve(specifier, importer) {
|
|
765
|
-
return
|
|
781
|
+
return _chunk24AGZQVRjs.resolveOutputSpecifier.call(void 0, specifier, importer, outputDir, (candidate) => Boolean(getEntry(candidate)));
|
|
766
782
|
},
|
|
767
783
|
load(id) {
|
|
768
|
-
const entry =
|
|
784
|
+
const entry = getEntry(id);
|
|
769
785
|
if (!entry) {
|
|
770
786
|
return void 0;
|
|
771
787
|
}
|
|
772
788
|
return readOutputEntry(entry);
|
|
773
789
|
},
|
|
774
790
|
filter(id) {
|
|
775
|
-
return
|
|
791
|
+
return Boolean(getEntry(id));
|
|
776
792
|
}
|
|
777
793
|
};
|
|
778
794
|
}
|
|
@@ -780,8 +796,12 @@ function applyLinkedResults(linked, entries, onLinkedUpdate, onApplied) {
|
|
|
780
796
|
if (!linked) {
|
|
781
797
|
return;
|
|
782
798
|
}
|
|
799
|
+
const normalizedEntries = /* @__PURE__ */ new Map();
|
|
800
|
+
for (const [entryId, entry] of entries) {
|
|
801
|
+
normalizedEntries.set(_chunk24AGZQVRjs.normalizeOutputPathKey.call(void 0, entryId), entry);
|
|
802
|
+
}
|
|
783
803
|
for (const [id, { code }] of Object.entries(linked)) {
|
|
784
|
-
const entry = entries.get(id);
|
|
804
|
+
const entry = _nullishCoalesce(entries.get(id), () => ( normalizedEntries.get(_chunk24AGZQVRjs.normalizeOutputPathKey.call(void 0, id))));
|
|
785
805
|
if (!entry) {
|
|
786
806
|
continue;
|
|
787
807
|
}
|
|
@@ -794,7 +814,7 @@ function applyLinkedResults(linked, entries, onLinkedUpdate, onApplied) {
|
|
|
794
814
|
} else {
|
|
795
815
|
entry.output.source = code;
|
|
796
816
|
}
|
|
797
|
-
_optionalChain([onApplied, 'optionalCall',
|
|
817
|
+
_optionalChain([onApplied, 'optionalCall', _37 => _37(entry, code)]);
|
|
798
818
|
onLinkedUpdate(entry.fileName, previous, code);
|
|
799
819
|
}
|
|
800
820
|
}
|
|
@@ -836,14 +856,14 @@ function createHtmlRuntimeAffectingSignature(source) {
|
|
|
836
856
|
}
|
|
837
857
|
function createJsRuntimeAffectingSignature(source) {
|
|
838
858
|
try {
|
|
839
|
-
const ast =
|
|
859
|
+
const ast = _chunkHVNGIKLSjs.babelParse.call(void 0, source, {
|
|
840
860
|
cache: true,
|
|
841
861
|
cacheKey: "vite-runtime-affecting:unambiguous",
|
|
842
862
|
plugins: ["jsx", "typescript"],
|
|
843
863
|
sourceType: "unambiguous"
|
|
844
864
|
});
|
|
845
865
|
const parts = [];
|
|
846
|
-
|
|
866
|
+
_chunkHVNGIKLSjs.traverse.call(void 0, ast, {
|
|
847
867
|
noScope: true,
|
|
848
868
|
StringLiteral(path7) {
|
|
849
869
|
parts.push(`s:${path7.node.value}`);
|
|
@@ -861,7 +881,7 @@ function createJsRuntimeAffectingSignature(source) {
|
|
|
861
881
|
const comments = ast.comments;
|
|
862
882
|
if (Array.isArray(comments)) {
|
|
863
883
|
for (const comment of comments) {
|
|
864
|
-
if (typeof _optionalChain([comment, 'optionalAccess',
|
|
884
|
+
if (typeof _optionalChain([comment, 'optionalAccess', _38 => _38.value]) === "string" && comment.value.length > 0) {
|
|
865
885
|
parts.push(`c:${comment.value}`);
|
|
866
886
|
}
|
|
867
887
|
}
|
|
@@ -892,6 +912,7 @@ function createBundleBuildState() {
|
|
|
892
912
|
return {
|
|
893
913
|
iteration: 0,
|
|
894
914
|
sourceHashByFile: /* @__PURE__ */ new Map(),
|
|
915
|
+
runtimeAffectingSignatureByFile: /* @__PURE__ */ new Map(),
|
|
895
916
|
runtimeAffectingHashByFile: /* @__PURE__ */ new Map(),
|
|
896
917
|
linkedByEntry: /* @__PURE__ */ new Map(),
|
|
897
918
|
dependentsByLinkedFile: /* @__PURE__ */ new Map()
|
|
@@ -935,7 +956,7 @@ function collectJsEntries(fileName, output, outDir, store) {
|
|
|
935
956
|
if (!isJavaScriptEntry(entry)) {
|
|
936
957
|
return;
|
|
937
958
|
}
|
|
938
|
-
const absolute =
|
|
959
|
+
const absolute = _chunk24AGZQVRjs.toAbsoluteOutputPath.call(void 0, fileName, outDir);
|
|
939
960
|
store.set(absolute, entry);
|
|
940
961
|
}
|
|
941
962
|
function markProcessFile(type, file, processFiles) {
|
|
@@ -959,16 +980,18 @@ function buildBundleSnapshot(bundle, opts, outDir, state, forceAll = false) {
|
|
|
959
980
|
const source = readEntrySource(output);
|
|
960
981
|
const hash = opts.cache.computeHash(source);
|
|
961
982
|
sourceHashByFile.set(file, hash);
|
|
962
|
-
const runtimeAffectingSignature = createRuntimeAffectingSourceSignature(source, type);
|
|
963
|
-
runtimeAffectingSignatureByFile.set(file, runtimeAffectingSignature);
|
|
964
|
-
const runtimeAffectingHash = opts.cache.computeHash(runtimeAffectingSignature);
|
|
965
|
-
runtimeAffectingHashByFile.set(file, runtimeAffectingHash);
|
|
966
983
|
const previousHash = state.sourceHashByFile.get(file);
|
|
967
984
|
const changed = previousHash == null || previousHash !== hash;
|
|
985
|
+
const previousRuntimeAffectingSignature = state.runtimeAffectingSignatureByFile.get(file);
|
|
986
|
+
const previousRuntimeAffectingHash = state.runtimeAffectingHashByFile.get(file);
|
|
987
|
+
const canReuseRuntimeAffectingSignature = !changed && previousRuntimeAffectingSignature != null && previousRuntimeAffectingHash != null;
|
|
988
|
+
const runtimeAffectingSignature = canReuseRuntimeAffectingSignature ? previousRuntimeAffectingSignature : createRuntimeAffectingSourceSignature(source, type);
|
|
989
|
+
const runtimeAffectingHash = canReuseRuntimeAffectingSignature ? previousRuntimeAffectingHash : opts.cache.computeHash(runtimeAffectingSignature);
|
|
990
|
+
runtimeAffectingSignatureByFile.set(file, runtimeAffectingSignature);
|
|
991
|
+
runtimeAffectingHashByFile.set(file, runtimeAffectingHash);
|
|
968
992
|
if (changed) {
|
|
969
993
|
changedByType[type].add(file);
|
|
970
994
|
}
|
|
971
|
-
const previousRuntimeAffectingHash = state.runtimeAffectingHashByFile.get(file);
|
|
972
995
|
const runtimeAffectingChanged = previousRuntimeAffectingHash == null || previousRuntimeAffectingHash !== runtimeAffectingHash;
|
|
973
996
|
if (runtimeAffectingChanged) {
|
|
974
997
|
runtimeAffectingChangedByType[type].add(file);
|
|
@@ -1038,6 +1061,7 @@ function updateBundleBuildState(state, snapshot, linkedByEntry, options = {}) {
|
|
|
1038
1061
|
...state.sourceHashByFile,
|
|
1039
1062
|
...snapshot.sourceHashByFile
|
|
1040
1063
|
]) : snapshot.sourceHashByFile;
|
|
1064
|
+
state.runtimeAffectingSignatureByFile = incremental ? new Map([...state.runtimeAffectingSignatureByFile, ...snapshot.runtimeAffectingSignatureByFile]) : snapshot.runtimeAffectingSignatureByFile;
|
|
1041
1065
|
state.runtimeAffectingHashByFile = incremental ? new Map([
|
|
1042
1066
|
...state.runtimeAffectingHashByFile,
|
|
1043
1067
|
...snapshot.runtimeAffectingHashByFile
|
|
@@ -1079,6 +1103,9 @@ function createEmptyMetrics() {
|
|
|
1079
1103
|
function measureElapsed(start) {
|
|
1080
1104
|
return performance.now() - start;
|
|
1081
1105
|
}
|
|
1106
|
+
function resolveUniAppXJsTransformEnabled2(uniAppX) {
|
|
1107
|
+
return uniAppX === void 0 ? true : _chunkZAA5ZG3Djs.isUniAppXEnabled.call(void 0, uniAppX);
|
|
1108
|
+
}
|
|
1082
1109
|
function formatCacheHitRate(metric) {
|
|
1083
1110
|
if (metric.total === 0) {
|
|
1084
1111
|
return "0.00%";
|
|
@@ -1126,11 +1153,36 @@ function createJsHashSalt(runtimeSignature, linkedImpactSignature) {
|
|
|
1126
1153
|
}
|
|
1127
1154
|
return `${runtimeSignature}:linked:${linkedImpactSignature}`;
|
|
1128
1155
|
}
|
|
1156
|
+
function getSnapshotHash(snapshotMap, file, fallback) {
|
|
1157
|
+
return _nullishCoalesce(snapshotMap.get(file), () => ( fallback));
|
|
1158
|
+
}
|
|
1129
1159
|
function hasRuntimeAffectingSourceChanges(changedByType) {
|
|
1130
1160
|
return changedByType.html.size > 0 || changedByType.js.size > 0;
|
|
1131
1161
|
}
|
|
1132
|
-
|
|
1133
|
-
|
|
1162
|
+
var CSS_URL_FUNCTION_RE = /url\((?:"([^"]*)"|'([^']*)'|([^)]*))\)/gi;
|
|
1163
|
+
var CSS_PATH_INDEPENDENT_URL_RE = /^(?:[a-z][a-z\d+.-]*:|\/\/|\/|#)/i;
|
|
1164
|
+
var CSS_IMPORT_RE = /@import\b/i;
|
|
1165
|
+
function isPathIndependentCssUrl(value) {
|
|
1166
|
+
const normalized = value.trim();
|
|
1167
|
+
return normalized.length > 0 && CSS_PATH_INDEPENDENT_URL_RE.test(normalized);
|
|
1168
|
+
}
|
|
1169
|
+
function hasPathDependentCssUrl(rawSource) {
|
|
1170
|
+
CSS_URL_FUNCTION_RE.lastIndex = 0;
|
|
1171
|
+
let match = CSS_URL_FUNCTION_RE.exec(rawSource);
|
|
1172
|
+
while (match !== null) {
|
|
1173
|
+
const value = _nullishCoalesce(_nullishCoalesce(_nullishCoalesce(match[1], () => ( match[2])), () => ( match[3])), () => ( ""));
|
|
1174
|
+
if (!isPathIndependentCssUrl(value)) {
|
|
1175
|
+
return true;
|
|
1176
|
+
}
|
|
1177
|
+
match = CSS_URL_FUNCTION_RE.exec(rawSource);
|
|
1178
|
+
}
|
|
1179
|
+
return false;
|
|
1180
|
+
}
|
|
1181
|
+
function createCssTransformShareScope(file, rawSource) {
|
|
1182
|
+
if (CSS_IMPORT_RE.test(rawSource) || hasPathDependentCssUrl(rawSource)) {
|
|
1183
|
+
return `dir:${_chunk24AGZQVRjs.normalizeOutputPathKey.call(void 0, _path2.default.dirname(file))}`;
|
|
1184
|
+
}
|
|
1185
|
+
return "global";
|
|
1134
1186
|
}
|
|
1135
1187
|
function hasOmittedKnownBundleFiles(currentBundleFiles, previousBundleFiles) {
|
|
1136
1188
|
const currentFileSet = new Set(currentBundleFiles);
|
|
@@ -1218,10 +1270,10 @@ function createGenerateBundleHook(context) {
|
|
|
1218
1270
|
const debugCssDiff = _process2.default.env.WEAPP_TW_VITE_DEBUG_CSS_DIFF === "1";
|
|
1219
1271
|
const resolvedConfig = getResolvedConfig();
|
|
1220
1272
|
const bundleFiles = Object.keys(bundle);
|
|
1221
|
-
const buildCommand = _optionalChain([resolvedConfig, 'optionalAccess',
|
|
1273
|
+
const buildCommand = _optionalChain([resolvedConfig, 'optionalAccess', _39 => _39.command]) === "build";
|
|
1222
1274
|
const useIncrementalMode = !buildCommand || hasOmittedKnownBundleFiles(bundleFiles, state.sourceHashByFile.keys());
|
|
1223
|
-
const rootDir = _optionalChain([resolvedConfig, 'optionalAccess',
|
|
1224
|
-
const outDir = _optionalChain([resolvedConfig, 'optionalAccess',
|
|
1275
|
+
const rootDir = _optionalChain([resolvedConfig, 'optionalAccess', _40 => _40.root]) ? _path2.default.resolve(resolvedConfig.root) : _process2.default.cwd();
|
|
1276
|
+
const outDir = _optionalChain([resolvedConfig, 'optionalAccess', _41 => _41.build, 'optionalAccess', _42 => _42.outDir]) ? _path2.default.resolve(rootDir, resolvedConfig.build.outDir) : rootDir;
|
|
1225
1277
|
const snapshot = buildBundleSnapshot(bundle, opts, outDir, state, disableDirtyOptimization || !useIncrementalMode);
|
|
1226
1278
|
const useBundleRuntimeClassSet = useIncrementalMode || runtimeState.twPatcher.majorVersion === 4;
|
|
1227
1279
|
const forceRuntimeRefreshBySource = useIncrementalMode && hasRuntimeAffectingSourceChanges(snapshot.runtimeAffectingChangedByType);
|
|
@@ -1261,6 +1313,11 @@ function createGenerateBundleHook(context) {
|
|
|
1261
1313
|
);
|
|
1262
1314
|
}
|
|
1263
1315
|
const jsEntries = snapshot.jsEntries;
|
|
1316
|
+
const normalizedJsEntries = /* @__PURE__ */ new Map();
|
|
1317
|
+
for (const [id, entry] of jsEntries) {
|
|
1318
|
+
normalizedJsEntries.set(_chunk24AGZQVRjs.normalizeOutputPathKey.call(void 0, id), entry);
|
|
1319
|
+
}
|
|
1320
|
+
const getJsEntry = (id) => _nullishCoalesce(jsEntries.get(id), () => ( normalizedJsEntries.get(_chunk24AGZQVRjs.normalizeOutputPathKey.call(void 0, id))));
|
|
1264
1321
|
const moduleGraphOptions = createBundleModuleGraphOptions(outDir, jsEntries);
|
|
1265
1322
|
const runtimeStart = performance.now();
|
|
1266
1323
|
const runtime = useBundleRuntimeClassSet ? await ensureBundleRuntimeClassSet(snapshot, forceRuntimeRefreshByEnv) : await context.ensureRuntimeClassSet(forceRuntimeRefreshByEnv);
|
|
@@ -1276,7 +1333,7 @@ function createGenerateBundleHook(context) {
|
|
|
1276
1333
|
);
|
|
1277
1334
|
}
|
|
1278
1335
|
debug3("get runtimeSet, class count: %d", runtime.size);
|
|
1279
|
-
const runtimeSignature = _nullishCoalesce(
|
|
1336
|
+
const runtimeSignature = _nullishCoalesce(_chunkZAA5ZG3Djs.getRuntimeClassSetSignature.call(void 0, runtimeState.twPatcher), () => ( "runtime:missing"));
|
|
1280
1337
|
const handleLinkedUpdate = (fileName, previous, next) => {
|
|
1281
1338
|
onUpdate(fileName, previous, next);
|
|
1282
1339
|
debug3("js linked handle: %s", fileName);
|
|
@@ -1300,7 +1357,7 @@ function createGenerateBundleHook(context) {
|
|
|
1300
1357
|
tailwindcssMajorVersion: runtimeState.twPatcher.majorVersion,
|
|
1301
1358
|
moduleGraph: moduleGraphOptions,
|
|
1302
1359
|
babelParserOptions: {
|
|
1303
|
-
..._nullishCoalesce(_optionalChain([extra, 'optionalAccess',
|
|
1360
|
+
..._nullishCoalesce(_optionalChain([extra, 'optionalAccess', _43 => _43.babelParserOptions]), () => ( {})),
|
|
1304
1361
|
sourceFilename: absoluteFilename
|
|
1305
1362
|
}
|
|
1306
1363
|
});
|
|
@@ -1320,8 +1377,8 @@ function createGenerateBundleHook(context) {
|
|
|
1320
1377
|
_chunkOF6MFURRjs.processCachedTask.call(void 0, {
|
|
1321
1378
|
cache,
|
|
1322
1379
|
cacheKey: file,
|
|
1323
|
-
rawSource,
|
|
1324
1380
|
hashKey: `${file}:html:${runtimeSignature}`,
|
|
1381
|
+
hash: getSnapshotHash(snapshot.sourceHashByFile, file, rawSource),
|
|
1325
1382
|
applyResult(source) {
|
|
1326
1383
|
originalSource.source = source;
|
|
1327
1384
|
},
|
|
@@ -1368,14 +1425,15 @@ function createGenerateBundleHook(context) {
|
|
|
1368
1425
|
metrics.css.total++;
|
|
1369
1426
|
const rawSource = originalEntrySource;
|
|
1370
1427
|
const cssRuntimeAffectingSignature = _nullishCoalesce(snapshot.runtimeAffectingSignatureByFile.get(file), () => ( rawSource));
|
|
1371
|
-
const
|
|
1372
|
-
const
|
|
1428
|
+
const cssShareScope = createCssTransformShareScope(file, rawSource);
|
|
1429
|
+
const cssHandlerOptions = getCssHandlerOptions(file);
|
|
1430
|
+
const cssSharedCacheKey = `${cssShareScope}:${runtimeSignature}:${_nullishCoalesce(runtimeState.twPatcher.majorVersion, () => ( "unknown"))}:${cssHandlerOptions.isMainChunk ? "1" : "0"}:${cssRuntimeAffectingSignature}`;
|
|
1373
1431
|
tasks.push(
|
|
1374
1432
|
_chunkOF6MFURRjs.processCachedTask.call(void 0, {
|
|
1375
1433
|
cache,
|
|
1376
1434
|
cacheKey: file,
|
|
1377
1435
|
hashKey: `${file}:css:${runtimeSignature}:${_nullishCoalesce(runtimeState.twPatcher.majorVersion, () => ( "unknown"))}`,
|
|
1378
|
-
|
|
1436
|
+
hash: getSnapshotHash(snapshot.runtimeAffectingHashByFile, file, cssRuntimeAffectingSignature),
|
|
1379
1437
|
applyResult(source) {
|
|
1380
1438
|
originalSource.source = source;
|
|
1381
1439
|
},
|
|
@@ -1448,8 +1506,7 @@ function createGenerateBundleHook(context) {
|
|
|
1448
1506
|
cache,
|
|
1449
1507
|
cacheKey: file,
|
|
1450
1508
|
hashKey: `${file}:js`,
|
|
1451
|
-
|
|
1452
|
-
/*${hashSalt}*/`,
|
|
1509
|
+
hash: `${getSnapshotHash(snapshot.sourceHashByFile, file, initialRawSource)}:${hashSalt}`,
|
|
1453
1510
|
applyResult(source) {
|
|
1454
1511
|
originalSource.code = source;
|
|
1455
1512
|
},
|
|
@@ -1464,7 +1521,7 @@ function createGenerateBundleHook(context) {
|
|
|
1464
1521
|
debug3("js cache replay miss, fallback transform: %s", file);
|
|
1465
1522
|
}
|
|
1466
1523
|
const handlerOptions = createHandlerOptions(absoluteFile);
|
|
1467
|
-
if (!disableJsPrecheck &&
|
|
1524
|
+
if (!disableJsPrecheck && _chunkHVNGIKLSjs.shouldSkipJsTransform.call(void 0, rawSource, handlerOptions)) {
|
|
1468
1525
|
metrics.js.elapsed += measureElapsed(start);
|
|
1469
1526
|
metrics.js.transformed++;
|
|
1470
1527
|
return {
|
|
@@ -1478,7 +1535,7 @@ function createGenerateBundleHook(context) {
|
|
|
1478
1535
|
debug3("js handle: %s", file);
|
|
1479
1536
|
if (linked) {
|
|
1480
1537
|
for (const id of Object.keys(linked)) {
|
|
1481
|
-
const linkedEntry =
|
|
1538
|
+
const linkedEntry = getJsEntry(id);
|
|
1482
1539
|
if (linkedEntry && linkedSet) {
|
|
1483
1540
|
linkedSet.add(linkedEntry.fileName);
|
|
1484
1541
|
}
|
|
@@ -1500,7 +1557,7 @@ function createGenerateBundleHook(context) {
|
|
|
1500
1557
|
const wrappedApplyLinkedUpdates = (linked) => {
|
|
1501
1558
|
if (linked) {
|
|
1502
1559
|
for (const id of Object.keys(linked)) {
|
|
1503
|
-
const linkedEntry =
|
|
1560
|
+
const linkedEntry = getJsEntry(id);
|
|
1504
1561
|
if (linkedEntry && linkedSet) {
|
|
1505
1562
|
linkedSet.add(linkedEntry.fileName);
|
|
1506
1563
|
}
|
|
@@ -1544,13 +1601,13 @@ function createGenerateBundleHook(context) {
|
|
|
1544
1601
|
const currentSource = originalEntrySource;
|
|
1545
1602
|
const absoluteFile = _path2.default.resolve(outDir, file);
|
|
1546
1603
|
const precheckOptions = createHandlerOptions(absoluteFile, {
|
|
1547
|
-
uniAppX:
|
|
1604
|
+
uniAppX: resolveUniAppXJsTransformEnabled2(uniAppX),
|
|
1548
1605
|
babelParserOptions: {
|
|
1549
1606
|
plugins: ["typescript"],
|
|
1550
1607
|
sourceType: "unambiguous"
|
|
1551
1608
|
}
|
|
1552
1609
|
});
|
|
1553
|
-
if (!disableJsPrecheck &&
|
|
1610
|
+
if (!disableJsPrecheck && _chunkHVNGIKLSjs.shouldSkipJsTransform.call(void 0, currentSource, precheckOptions)) {
|
|
1554
1611
|
metrics.js.elapsed += measureElapsed(start);
|
|
1555
1612
|
metrics.js.transformed++;
|
|
1556
1613
|
return;
|
|
@@ -1561,7 +1618,7 @@ function createGenerateBundleHook(context) {
|
|
|
1561
1618
|
});
|
|
1562
1619
|
}
|
|
1563
1620
|
}
|
|
1564
|
-
|
|
1621
|
+
_chunk24AGZQVRjs.pushConcurrentTaskFactories.call(void 0, tasks, jsTaskFactories);
|
|
1565
1622
|
await Promise.all(tasks);
|
|
1566
1623
|
for (const apply of pendingLinkedUpdates) {
|
|
1567
1624
|
apply();
|
|
@@ -1603,8 +1660,8 @@ var _module = require('module');
|
|
|
1603
1660
|
|
|
1604
1661
|
|
|
1605
1662
|
var _tailwindcsspatch = require('tailwindcss-patch');
|
|
1606
|
-
var debug =
|
|
1607
|
-
var require2 = _module.createRequire.call(void 0,
|
|
1663
|
+
var debug = _chunkHVNGIKLSjs.createDebug.call(void 0, "[vite:runtime-set] ");
|
|
1664
|
+
var require2 = _module.createRequire.call(void 0, _chunkRKISS72Pjs.importMetaUrl);
|
|
1608
1665
|
var EXTENSION_DOT_PREFIX_RE = /^\./;
|
|
1609
1666
|
var VALIDATION_FILE_NAME = "runtime-candidates.html";
|
|
1610
1667
|
var tailwindNodeModulePromise;
|
|
@@ -1621,23 +1678,23 @@ function isPostcssPluginImportTarget(value) {
|
|
|
1621
1678
|
return value === "@tailwindcss/postcss" || value === "@tailwindcss/postcss7-compat" || value.includes("/postcss");
|
|
1622
1679
|
}
|
|
1623
1680
|
function resolveTailwindCssImportTarget(patcher) {
|
|
1624
|
-
const tailwindOptions =
|
|
1625
|
-
const cssEntries = _optionalChain([tailwindOptions, 'optionalAccess',
|
|
1681
|
+
const tailwindOptions = _chunkZAA5ZG3Djs.resolveTailwindcssOptions.call(void 0, patcher.options);
|
|
1682
|
+
const cssEntries = _optionalChain([tailwindOptions, 'optionalAccess', _44 => _44.v4, 'optionalAccess', _45 => _45.cssEntries, 'optionalAccess', _46 => _46.filter, 'call', _47 => _47((item) => typeof item === "string" && item.length > 0)]);
|
|
1626
1683
|
if (cssEntries && cssEntries.length > 0) {
|
|
1627
1684
|
return createCssImportSource(cssEntries);
|
|
1628
1685
|
}
|
|
1629
|
-
const configuredPackageName = _optionalChain([tailwindOptions, 'optionalAccess',
|
|
1686
|
+
const configuredPackageName = _optionalChain([tailwindOptions, 'optionalAccess', _48 => _48.packageName]);
|
|
1630
1687
|
if (typeof configuredPackageName === "string" && configuredPackageName.length > 0 && !isPostcssPluginImportTarget(configuredPackageName)) {
|
|
1631
1688
|
return createCssImportSource([configuredPackageName]);
|
|
1632
1689
|
}
|
|
1633
|
-
const packageName = _optionalChain([patcher, 'access',
|
|
1690
|
+
const packageName = _optionalChain([patcher, 'access', _49 => _49.packageInfo, 'optionalAccess', _50 => _50.name]);
|
|
1634
1691
|
if (typeof packageName === "string" && packageName.length > 0 && !isPostcssPluginImportTarget(packageName)) {
|
|
1635
1692
|
return createCssImportSource([packageName]);
|
|
1636
1693
|
}
|
|
1637
1694
|
return createCssImportSource(["tailwindcss"]);
|
|
1638
1695
|
}
|
|
1639
1696
|
function getProjectRoot(patcher) {
|
|
1640
|
-
return _nullishCoalesce(_optionalChain([patcher, 'access',
|
|
1697
|
+
return _nullishCoalesce(_optionalChain([patcher, 'access', _51 => _51.options, 'optionalAccess', _52 => _52.projectRoot]), () => ( _process2.default.cwd()));
|
|
1641
1698
|
}
|
|
1642
1699
|
async function importTailwindNodeModule() {
|
|
1643
1700
|
if (!tailwindNodeModulePromise) {
|
|
@@ -1664,16 +1721,16 @@ function resolveMaybeAbsolute(base, value) {
|
|
|
1664
1721
|
}
|
|
1665
1722
|
async function resolveTailwindCssSource(patcher) {
|
|
1666
1723
|
const projectRoot = getProjectRoot(patcher);
|
|
1667
|
-
const tailwindOptions =
|
|
1668
|
-
const configuredBase = resolveMaybeAbsolute(projectRoot, _optionalChain([tailwindOptions, 'optionalAccess',
|
|
1669
|
-
const configDir = _optionalChain([tailwindOptions, 'optionalAccess',
|
|
1724
|
+
const tailwindOptions = _chunkZAA5ZG3Djs.resolveTailwindcssOptions.call(void 0, patcher.options);
|
|
1725
|
+
const configuredBase = resolveMaybeAbsolute(projectRoot, _optionalChain([tailwindOptions, 'optionalAccess', _53 => _53.v4, 'optionalAccess', _54 => _54.base]));
|
|
1726
|
+
const configDir = _optionalChain([tailwindOptions, 'optionalAccess', _55 => _55.config]) ? _path2.default.dirname(tailwindOptions.config) : void 0;
|
|
1670
1727
|
const sharedFallbacks = [
|
|
1671
1728
|
configuredBase,
|
|
1672
1729
|
projectRoot,
|
|
1673
|
-
_optionalChain([tailwindOptions, 'optionalAccess',
|
|
1730
|
+
_optionalChain([tailwindOptions, 'optionalAccess', _56 => _56.cwd]),
|
|
1674
1731
|
configDir
|
|
1675
1732
|
].filter((item) => typeof item === "string" && item.length > 0);
|
|
1676
|
-
if (_optionalChain([tailwindOptions, 'optionalAccess',
|
|
1733
|
+
if (_optionalChain([tailwindOptions, 'optionalAccess', _57 => _57.v4, 'optionalAccess', _58 => _58.css])) {
|
|
1677
1734
|
return {
|
|
1678
1735
|
projectRoot,
|
|
1679
1736
|
base: _nullishCoalesce(configuredBase, () => ( projectRoot)),
|
|
@@ -1681,7 +1738,7 @@ async function resolveTailwindCssSource(patcher) {
|
|
|
1681
1738
|
css: tailwindOptions.v4.css
|
|
1682
1739
|
};
|
|
1683
1740
|
}
|
|
1684
|
-
const cssEntries = _nullishCoalesce(_optionalChain([tailwindOptions, 'optionalAccess',
|
|
1741
|
+
const cssEntries = _nullishCoalesce(_optionalChain([tailwindOptions, 'optionalAccess', _59 => _59.v4, 'optionalAccess', _60 => _60.cssEntries, 'optionalAccess', _61 => _61.filter, 'call', _62 => _62((item) => typeof item === "string" && item.length > 0)]), () => ( []));
|
|
1685
1742
|
if (cssEntries.length > 0) {
|
|
1686
1743
|
const resolvedEntries = cssEntries.map((entry) => _nullishCoalesce(resolveMaybeAbsolute(projectRoot, entry), () => ( entry)));
|
|
1687
1744
|
const cssChunks = [];
|
|
@@ -1862,7 +1919,7 @@ function createBundleRuntimeClassSetManager(options = {}) {
|
|
|
1862
1919
|
const matches = await extractRawCandidates(entry.source, resolveEntryExtension(entry));
|
|
1863
1920
|
const candidates = /* @__PURE__ */ new Set();
|
|
1864
1921
|
for (const match of matches) {
|
|
1865
|
-
const candidate = _optionalChain([match, 'optionalAccess',
|
|
1922
|
+
const candidate = _optionalChain([match, 'optionalAccess', _63 => _63.rawCandidate]);
|
|
1866
1923
|
if (typeof candidate === "string" && candidate.length > 0) {
|
|
1867
1924
|
candidates.add(candidate);
|
|
1868
1925
|
}
|
|
@@ -1870,7 +1927,7 @@ function createBundleRuntimeClassSetManager(options = {}) {
|
|
|
1870
1927
|
return candidates;
|
|
1871
1928
|
}
|
|
1872
1929
|
async function sync(patcher, snapshot) {
|
|
1873
|
-
const nextSignature = _nullishCoalesce(
|
|
1930
|
+
const nextSignature = _nullishCoalesce(_chunkZAA5ZG3Djs.getRuntimeClassSetSignature.call(void 0, patcher), () => ( "runtime:missing"));
|
|
1874
1931
|
const runtimeEntries = createRuntimeEntries(snapshot);
|
|
1875
1932
|
const runtimeEntriesByFile = new Map(runtimeEntries.map((entry) => [entry.file, entry]));
|
|
1876
1933
|
const currentRuntimeFiles = new Set(runtimeEntriesByFile.keys());
|
|
@@ -2068,15 +2125,15 @@ function createRewriteCssImportsPlugins(options) {
|
|
|
2068
2125
|
return [];
|
|
2069
2126
|
}
|
|
2070
2127
|
const { appType, getAppType, weappTailwindcssDirPosix: weappTailwindcssDirPosix2 } = options;
|
|
2071
|
-
const resolveAppType = () => _nullishCoalesce(_optionalChain([getAppType, 'optionalCall',
|
|
2128
|
+
const resolveAppType = () => _nullishCoalesce(_optionalChain([getAppType, 'optionalCall', _64 => _64()]), () => ( appType));
|
|
2072
2129
|
return [
|
|
2073
2130
|
{
|
|
2074
|
-
name: `${
|
|
2131
|
+
name: `${_chunkHVNGIKLSjs.vitePluginName}:rewrite-css-imports`,
|
|
2075
2132
|
enforce: "pre",
|
|
2076
2133
|
resolveId: {
|
|
2077
2134
|
order: "pre",
|
|
2078
2135
|
handler(id, importer) {
|
|
2079
|
-
const replacement =
|
|
2136
|
+
const replacement = _chunk24AGZQVRjs.resolveTailwindcssImport.call(void 0, id, weappTailwindcssDirPosix2, {
|
|
2080
2137
|
join: joinPosixPath,
|
|
2081
2138
|
appType: resolveAppType()
|
|
2082
2139
|
});
|
|
@@ -2095,7 +2152,7 @@ function createRewriteCssImportsPlugins(options) {
|
|
|
2095
2152
|
if (!isCSSRequest(id)) {
|
|
2096
2153
|
return null;
|
|
2097
2154
|
}
|
|
2098
|
-
const rewritten =
|
|
2155
|
+
const rewritten = _chunk24AGZQVRjs.rewriteTailwindcssImportsInCode.call(void 0, code, weappTailwindcssDirPosix2, {
|
|
2099
2156
|
join: joinPosixPath,
|
|
2100
2157
|
appType: resolveAppType()
|
|
2101
2158
|
});
|
|
@@ -2113,10 +2170,17 @@ function createRewriteCssImportsPlugins(options) {
|
|
|
2113
2170
|
}
|
|
2114
2171
|
|
|
2115
2172
|
// src/bundlers/vite/index.ts
|
|
2116
|
-
var debug2 =
|
|
2117
|
-
var weappTailwindcssPackageDir =
|
|
2173
|
+
var debug2 = _chunkHVNGIKLSjs.createDebug.call(void 0, );
|
|
2174
|
+
var weappTailwindcssPackageDir = _chunk24AGZQVRjs.resolvePackageDir.call(void 0, "weapp-tailwindcss");
|
|
2118
2175
|
var weappTailwindcssDirPosix = slash(weappTailwindcssPackageDir);
|
|
2119
2176
|
var PACKAGE_JSON_FILE2 = "package.json";
|
|
2177
|
+
function getPostcssPluginName(plugin) {
|
|
2178
|
+
if (!plugin || typeof plugin !== "object" || !("postcssPlugin" in plugin)) {
|
|
2179
|
+
return;
|
|
2180
|
+
}
|
|
2181
|
+
const { postcssPlugin } = plugin;
|
|
2182
|
+
return typeof postcssPlugin === "string" ? postcssPlugin : void 0;
|
|
2183
|
+
}
|
|
2120
2184
|
function resolveImplicitTailwindcssBasedirFromViteRoot(root) {
|
|
2121
2185
|
const resolvedRoot = _path2.default.resolve(root);
|
|
2122
2186
|
if (!_fs.existsSync.call(void 0, resolvedRoot)) {
|
|
@@ -2132,11 +2196,11 @@ function resolveImplicitTailwindcssBasedirFromViteRoot(root) {
|
|
|
2132
2196
|
}
|
|
2133
2197
|
current = parent;
|
|
2134
2198
|
}
|
|
2135
|
-
const tailwindConfigPath =
|
|
2199
|
+
const tailwindConfigPath = _chunkZAA5ZG3Djs.findTailwindConfig.call(void 0, searchRoots);
|
|
2136
2200
|
if (tailwindConfigPath) {
|
|
2137
2201
|
return _path2.default.dirname(tailwindConfigPath);
|
|
2138
2202
|
}
|
|
2139
|
-
const packageRoot =
|
|
2203
|
+
const packageRoot = _chunkZAA5ZG3Djs.findNearestPackageRoot.call(void 0, resolvedRoot);
|
|
2140
2204
|
if (packageRoot && _fs.existsSync.call(void 0, _path2.default.join(packageRoot, PACKAGE_JSON_FILE2))) {
|
|
2141
2205
|
return packageRoot;
|
|
2142
2206
|
}
|
|
@@ -2146,7 +2210,7 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
|
|
|
2146
2210
|
const hasExplicitAppType = typeof options.appType === "string" && options.appType.trim().length > 0;
|
|
2147
2211
|
const rewriteCssImportsSpecified = Object.hasOwn(options, "rewriteCssImports");
|
|
2148
2212
|
const hasExplicitTailwindcssBasedir = typeof options.tailwindcssBasedir === "string" && options.tailwindcssBasedir.trim().length > 0;
|
|
2149
|
-
const opts =
|
|
2213
|
+
const opts = _chunkHVNGIKLSjs.getCompilerContext.call(void 0, options);
|
|
2150
2214
|
const {
|
|
2151
2215
|
disabled,
|
|
2152
2216
|
customAttributes,
|
|
@@ -2159,8 +2223,8 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
|
|
|
2159
2223
|
uniAppX,
|
|
2160
2224
|
disabledDefaultTemplateHandler
|
|
2161
2225
|
} = opts;
|
|
2162
|
-
const uniAppXEnabled =
|
|
2163
|
-
const disabledOptions =
|
|
2226
|
+
const uniAppXEnabled = _chunkZAA5ZG3Djs.isUniAppXEnabled.call(void 0, uniAppX);
|
|
2227
|
+
const disabledOptions = _chunk24AGZQVRjs.resolveDisabledOptions.call(void 0, disabled);
|
|
2164
2228
|
const tailwindcssMajorVersion = _nullishCoalesce(initialTwPatcher.majorVersion, () => ( 0));
|
|
2165
2229
|
const shouldRewriteCssImports = opts.rewriteCssImports !== false && !disabledOptions.rewriteCssImports && (rewriteCssImportsSpecified || tailwindcssMajorVersion >= 4);
|
|
2166
2230
|
const rewritePlugins = createRewriteCssImportsPlugins({
|
|
@@ -2171,8 +2235,8 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
|
|
|
2171
2235
|
if (disabledOptions.plugin) {
|
|
2172
2236
|
return rewritePlugins.length ? rewritePlugins : void 0;
|
|
2173
2237
|
}
|
|
2174
|
-
const customAttributesEntities =
|
|
2175
|
-
const patchRecorderState =
|
|
2238
|
+
const customAttributesEntities = _chunkHVNGIKLSjs.toCustomAttributesEntities.call(void 0, customAttributes);
|
|
2239
|
+
const patchRecorderState = _chunkHVNGIKLSjs.setupPatchRecorder.call(void 0, initialTwPatcher, opts.tailwindcssBasedir, {
|
|
2176
2240
|
source: "runtime",
|
|
2177
2241
|
cwd: _nullishCoalesce(opts.tailwindcssBasedir, () => ( _process2.default.cwd()))
|
|
2178
2242
|
});
|
|
@@ -2189,8 +2253,8 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
|
|
|
2189
2253
|
let runtimeRefreshOptionsKey;
|
|
2190
2254
|
const bundleRuntimeClassSetManager = createBundleRuntimeClassSetManager();
|
|
2191
2255
|
function resolveRuntimeRefreshOptions() {
|
|
2192
|
-
const configPath = _optionalChain([
|
|
2193
|
-
const signature =
|
|
2256
|
+
const configPath = _optionalChain([_chunkZAA5ZG3Djs.resolveTailwindcssOptions.call(void 0, runtimeState.twPatcher.options), 'optionalAccess', _65 => _65.config]);
|
|
2257
|
+
const signature = _chunkZAA5ZG3Djs.getRuntimeClassSetSignature.call(void 0, runtimeState.twPatcher);
|
|
2194
2258
|
const optionsKey = JSON.stringify({
|
|
2195
2259
|
appType: opts.appType,
|
|
2196
2260
|
uniAppX: uniAppXEnabled,
|
|
@@ -2211,7 +2275,7 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
|
|
|
2211
2275
|
async function refreshRuntimeState(force) {
|
|
2212
2276
|
const invalidation = resolveRuntimeRefreshOptions();
|
|
2213
2277
|
const shouldRefresh = force || invalidation.changed;
|
|
2214
|
-
const refreshed = await
|
|
2278
|
+
const refreshed = await _chunkHVNGIKLSjs.refreshTailwindRuntimeState.call(void 0, runtimeState, {
|
|
2215
2279
|
force: shouldRefresh,
|
|
2216
2280
|
clearCache: force || invalidation.changed
|
|
2217
2281
|
});
|
|
@@ -2232,7 +2296,7 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
|
|
|
2232
2296
|
}
|
|
2233
2297
|
if (forceRuntimeRefresh || !runtimeSetPromise) {
|
|
2234
2298
|
const invalidation = resolveRuntimeRefreshOptions();
|
|
2235
|
-
const task2 =
|
|
2299
|
+
const task2 = _chunkHVNGIKLSjs.collectRuntimeClassSet.call(void 0, runtimeState.twPatcher, {
|
|
2236
2300
|
force: forceRuntimeRefresh || invalidation.changed,
|
|
2237
2301
|
skipRefresh: forceRuntimeRefresh,
|
|
2238
2302
|
clearCache: forceRuntimeRefresh || invalidation.changed
|
|
@@ -2274,7 +2338,7 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
|
|
|
2274
2338
|
if (!forceRuntimeRefresh && !invalidation.changed && !forceCollectBySource && runtimeSet) {
|
|
2275
2339
|
return runtimeSet;
|
|
2276
2340
|
}
|
|
2277
|
-
const task =
|
|
2341
|
+
const task = _chunkHVNGIKLSjs.collectRuntimeClassSet.call(void 0, runtimeState.twPatcher, {
|
|
2278
2342
|
force: forceRuntimeRefresh || invalidation.changed || forceCollectBySource,
|
|
2279
2343
|
skipRefresh: forceRuntimeRefresh,
|
|
2280
2344
|
clearCache: forceRuntimeRefresh || invalidation.changed
|
|
@@ -2309,7 +2373,7 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
|
|
|
2309
2373
|
const plugins = [
|
|
2310
2374
|
...rewritePlugins,
|
|
2311
2375
|
{
|
|
2312
|
-
name: `${
|
|
2376
|
+
name: `${_chunkHVNGIKLSjs.vitePluginName}:post`,
|
|
2313
2377
|
enforce: "post",
|
|
2314
2378
|
async configResolved(config) {
|
|
2315
2379
|
resolvedConfig = config;
|
|
@@ -2347,10 +2411,7 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
|
|
|
2347
2411
|
}
|
|
2348
2412
|
if (typeof config.css.postcss === "object" && Array.isArray(config.css.postcss.plugins)) {
|
|
2349
2413
|
const postcssPlugins = config.css.postcss.plugins;
|
|
2350
|
-
const idx = postcssPlugins.findIndex((x) => (
|
|
2351
|
-
// @ts-ignore
|
|
2352
|
-
x.postcssPlugin === "postcss-html-transform"
|
|
2353
|
-
));
|
|
2414
|
+
const idx = postcssPlugins.findIndex((x) => getPostcssPluginName(x) === "postcss-html-transform");
|
|
2354
2415
|
if (idx > -1) {
|
|
2355
2416
|
postcssPlugins.splice(idx, 1, _htmltransform2.default.call(void 0, ));
|
|
2356
2417
|
debug2("remove postcss-html-transform plugin from vite config");
|