weapp-tailwindcss 4.12.0-alpha.3 → 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/dist/{chunk-L3O54VR6.js → chunk-24AGZQVR.js} +2 -2
- package/dist/{chunk-6VMGUTN6.mjs → chunk-57SOQCAU.mjs} +4 -4
- package/dist/{chunk-I5H5RDWS.mjs → chunk-5ZYHNDEK.mjs} +61 -23
- package/dist/{chunk-P2X2S444.js → chunk-DUHYLR2R.js} +7 -7
- package/dist/{chunk-UVMAPQU7.js → chunk-FS2NOOEB.js} +5 -5
- package/dist/{chunk-OSWTWMAK.js → chunk-HVNGIKLS.js} +33 -23
- package/dist/{chunk-2PFYPSPO.js → chunk-JZQBZHN5.js} +39 -39
- package/dist/{chunk-J6FIO3RO.mjs → chunk-KGTVD4EP.mjs} +19 -9
- package/dist/{chunk-HL3US2OT.mjs → chunk-NNOQDMUP.mjs} +1 -1
- package/dist/{chunk-SON7XE3T.js → chunk-OFB2KBRP.js} +146 -108
- package/dist/{chunk-AYJ4HLWZ.mjs → chunk-PCDYXXSK.mjs} +11 -4
- package/dist/{chunk-ONLKZIRQ.js → chunk-RKISS72P.js} +1 -1
- package/dist/{chunk-6MIA3KYY.mjs → chunk-RRQZL7FQ.mjs} +1 -1
- package/dist/{chunk-XHTCHZVE.mjs → chunk-XZP3MREK.mjs} +1 -1
- package/dist/{chunk-NIS74SI6.js → chunk-ZAA5ZG3D.js} +60 -53
- package/dist/cli.js +7 -7
- package/dist/cli.mjs +7 -7
- package/dist/core.js +9 -9
- package/dist/core.mjs +3 -3
- package/dist/css-macro/postcss.js +1 -1
- package/dist/css-macro/postcss.mjs +1 -1
- package/dist/css-macro.js +1 -1
- package/dist/css-macro.mjs +1 -1
- 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 +7 -7
- 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 +4 -4
- package/dist/webpack.js +7 -7
- package/dist/webpack.mjs +5 -5
- package/dist/webpack4.js +35 -35
- package/dist/webpack4.mjs +4 -4
- package/package.json +8 -8
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
var
|
|
10
|
+
var _chunk24AGZQVRjs = require('./chunk-24AGZQVR.js');
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
var _chunkOF6MFURRjs = require('./chunk-OF6MFURR.js');
|
|
@@ -28,7 +28,7 @@ var _chunkOF6MFURRjs = require('./chunk-OF6MFURR.js');
|
|
|
28
28
|
|
|
29
29
|
|
|
30
30
|
|
|
31
|
-
var
|
|
31
|
+
var _chunkHVNGIKLSjs = require('./chunk-HVNGIKLS.js');
|
|
32
32
|
|
|
33
33
|
|
|
34
34
|
|
|
@@ -37,13 +37,13 @@ var _chunkOSWTWMAKjs = require('./chunk-OSWTWMAK.js');
|
|
|
37
37
|
|
|
38
38
|
|
|
39
39
|
|
|
40
|
-
var
|
|
40
|
+
var _chunkZAA5ZG3Djs = require('./chunk-ZAA5ZG3D.js');
|
|
41
41
|
|
|
42
42
|
|
|
43
43
|
var _chunkDYLQ6UOIjs = require('./chunk-DYLQ6UOI.js');
|
|
44
44
|
|
|
45
45
|
|
|
46
|
-
var
|
|
46
|
+
var _chunkRKISS72Pjs = require('./chunk-RKISS72P.js');
|
|
47
47
|
|
|
48
48
|
// src/bundlers/vite/index.ts
|
|
49
49
|
var _fs = require('fs'); var _fs2 = _interopRequireDefault(_fs);
|
|
@@ -82,7 +82,7 @@ function extractLiteralValue(path7) {
|
|
|
82
82
|
}
|
|
83
83
|
return {
|
|
84
84
|
allowDoubleQuotes,
|
|
85
|
-
literal: path7.node.value.raw,
|
|
85
|
+
literal: typeof path7.node.value === "string" ? path7.node.value : path7.node.value.raw,
|
|
86
86
|
offset: 0
|
|
87
87
|
};
|
|
88
88
|
}
|
|
@@ -93,7 +93,7 @@ function isRuntimeCandidate(candidate, runtimeSet) {
|
|
|
93
93
|
if (!runtimeSet || runtimeSet.size === 0) {
|
|
94
94
|
return false;
|
|
95
95
|
}
|
|
96
|
-
return runtimeSet.has(candidate) || runtimeSet.has(
|
|
96
|
+
return runtimeSet.has(candidate) || runtimeSet.has(_chunkHVNGIKLSjs.replaceWxml.call(void 0, candidate));
|
|
97
97
|
}
|
|
98
98
|
function shouldEnableComponentLocalStyle(id) {
|
|
99
99
|
return COMPONENT_RE.test(id);
|
|
@@ -113,7 +113,7 @@ var UniAppXComponentLocalStyleCollector = class {
|
|
|
113
113
|
const alias = createAlias(this.fileId, utility, this.aliasByUtility.size);
|
|
114
114
|
this.aliasByUtility.set(utility, alias);
|
|
115
115
|
this.aliasByLookup.set(utility, alias);
|
|
116
|
-
this.aliasByLookup.set(
|
|
116
|
+
this.aliasByLookup.set(_chunkHVNGIKLSjs.replaceWxml.call(void 0, utility), alias);
|
|
117
117
|
return alias;
|
|
118
118
|
}
|
|
119
119
|
rewriteLiteral(literal, shouldInclude) {
|
|
@@ -136,15 +136,15 @@ var UniAppXComponentLocalStyleCollector = class {
|
|
|
136
136
|
collectRuntimeClasses(rawSource, options = {}) {
|
|
137
137
|
const wrapped = options.wrapExpression ? `${EXPRESSION_WRAPPER_PREFIX}${rawSource}${EXPRESSION_WRAPPER_SUFFIX}` : rawSource;
|
|
138
138
|
try {
|
|
139
|
-
const ast =
|
|
139
|
+
const ast = _chunkHVNGIKLSjs.babelParse.call(void 0, wrapped, {
|
|
140
140
|
plugins: ["typescript"],
|
|
141
141
|
sourceType: options.wrapExpression ? "module" : "unambiguous"
|
|
142
142
|
});
|
|
143
|
-
const analysis =
|
|
143
|
+
const analysis = _chunkHVNGIKLSjs.analyzeSource.call(void 0, ast, {}, void 0, false);
|
|
144
144
|
for (const path7 of analysis.targetPaths) {
|
|
145
145
|
const { literal, allowDoubleQuotes } = extractLiteralValue(path7);
|
|
146
146
|
const candidates = _extractors.splitCode.call(void 0, literal, allowDoubleQuotes);
|
|
147
|
-
const classContext = options.wrapExpression ||
|
|
147
|
+
const classContext = options.wrapExpression || _chunkHVNGIKLSjs.isClassContextLiteralPath.call(void 0, path7);
|
|
148
148
|
for (const candidate of candidates) {
|
|
149
149
|
if (!candidate || !classContext && !isRuntimeCandidate(candidate, this.runtimeSet)) {
|
|
150
150
|
continue;
|
|
@@ -163,15 +163,15 @@ var UniAppXComponentLocalStyleCollector = class {
|
|
|
163
163
|
}
|
|
164
164
|
const wrapped = options.wrapExpression ? `${EXPRESSION_WRAPPER_PREFIX}${rawSource}${EXPRESSION_WRAPPER_SUFFIX}` : rawSource;
|
|
165
165
|
try {
|
|
166
|
-
const ast =
|
|
166
|
+
const ast = _chunkHVNGIKLSjs.babelParse.call(void 0, wrapped, {
|
|
167
167
|
plugins: ["typescript"],
|
|
168
168
|
sourceType: options.wrapExpression ? "module" : "unambiguous"
|
|
169
169
|
});
|
|
170
|
-
const analysis =
|
|
170
|
+
const analysis = _chunkHVNGIKLSjs.analyzeSource.call(void 0, ast, {}, void 0, false);
|
|
171
171
|
if (analysis.targetPaths.length === 0) {
|
|
172
172
|
return rawSource;
|
|
173
173
|
}
|
|
174
|
-
const updater = new (0,
|
|
174
|
+
const updater = new (0, _chunkHVNGIKLSjs.JsTokenUpdater)();
|
|
175
175
|
for (const path7 of analysis.targetPaths) {
|
|
176
176
|
const { literal, allowDoubleQuotes, offset } = extractLiteralValue(path7);
|
|
177
177
|
const candidates = _extractors.splitCode.call(void 0, literal, allowDoubleQuotes);
|
|
@@ -252,7 +252,7 @@ function updateStaticAttribute(ms, prop, content = _optionalChain([prop, 'access
|
|
|
252
252
|
const start = prop.value.loc.start.offset + 1;
|
|
253
253
|
const end = prop.value.loc.end.offset - 1;
|
|
254
254
|
if (start < end) {
|
|
255
|
-
ms.update(start, end,
|
|
255
|
+
ms.update(start, end, _chunkHVNGIKLSjs.replaceWxml.call(void 0, _nullishCoalesce(content, () => ( ""))));
|
|
256
256
|
}
|
|
257
257
|
}
|
|
258
258
|
function updateStaticAttributeWithLocalStyle(ms, prop, collector, content = _optionalChain([prop, 'access', _3 => _3.value, 'optionalAccess', _4 => _4.content])) {
|
|
@@ -265,26 +265,28 @@ function updateStaticAttributeWithLocalStyle(ms, prop, collector, content = _opt
|
|
|
265
265
|
ms.update(start, end, collector.collectAndRewriteStaticClass(_nullishCoalesce(content, () => ( ""))));
|
|
266
266
|
}
|
|
267
267
|
}
|
|
268
|
-
function updateDirectiveExpression(ms, prop, jsHandler, runtimeSet
|
|
269
|
-
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) {
|
|
270
270
|
return;
|
|
271
271
|
}
|
|
272
|
+
const expression = prop.exp.content;
|
|
272
273
|
const start = prop.exp.loc.start.offset;
|
|
273
274
|
const end = prop.exp.loc.end.offset;
|
|
274
275
|
if (start >= end) {
|
|
275
276
|
return;
|
|
276
277
|
}
|
|
277
|
-
const generated =
|
|
278
|
+
const generated = _chunkHVNGIKLSjs.generateCode.call(void 0, expression, {
|
|
278
279
|
jsHandler,
|
|
279
280
|
runtimeSet,
|
|
280
281
|
wrapExpression: true
|
|
281
282
|
});
|
|
282
283
|
ms.update(start, end, generated);
|
|
283
284
|
}
|
|
284
|
-
function updateDirectiveExpressionWithLocalStyle(ms, prop, jsHandler, collector, runtimeSet
|
|
285
|
-
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) {
|
|
286
287
|
return;
|
|
287
288
|
}
|
|
289
|
+
const expression = prop.exp.content;
|
|
288
290
|
const start = prop.exp.loc.start.offset;
|
|
289
291
|
const end = prop.exp.loc.end.offset;
|
|
290
292
|
if (start >= end) {
|
|
@@ -293,7 +295,7 @@ function updateDirectiveExpressionWithLocalStyle(ms, prop, jsHandler, collector,
|
|
|
293
295
|
collector.collectRuntimeClasses(expression, {
|
|
294
296
|
wrapExpression: true
|
|
295
297
|
});
|
|
296
|
-
const generated =
|
|
298
|
+
const generated = _chunkHVNGIKLSjs.generateCode.call(void 0, expression, {
|
|
297
299
|
jsHandler,
|
|
298
300
|
runtimeSet,
|
|
299
301
|
wrapExpression: true
|
|
@@ -303,7 +305,7 @@ function updateDirectiveExpressionWithLocalStyle(ms, prop, jsHandler, collector,
|
|
|
303
305
|
function shouldHandleAttribute(tag, attrName, disabledDefaultTemplateHandler, matchCustomAttribute) {
|
|
304
306
|
const lowerName = attrName.toLowerCase();
|
|
305
307
|
const shouldHandleDefault = !disabledDefaultTemplateHandler && lowerName === "class";
|
|
306
|
-
const shouldHandleCustom = _nullishCoalesce(_optionalChain([matchCustomAttribute, 'optionalCall',
|
|
308
|
+
const shouldHandleCustom = _nullishCoalesce(_optionalChain([matchCustomAttribute, 'optionalCall', _9 => _9(tag, attrName)]), () => ( false));
|
|
307
309
|
return {
|
|
308
310
|
shouldHandleDefault,
|
|
309
311
|
shouldHandleCustom,
|
|
@@ -323,12 +325,12 @@ function transformUVue(code, id, jsHandler, runtimeSet, options = {}) {
|
|
|
323
325
|
return;
|
|
324
326
|
}
|
|
325
327
|
const { customAttributesEntities, disabledDefaultTemplateHandler = false } = options;
|
|
326
|
-
const matchCustomAttribute =
|
|
328
|
+
const matchCustomAttribute = _chunkHVNGIKLSjs.createAttributeMatcher.call(void 0, customAttributesEntities);
|
|
327
329
|
const ms = new (0, _magicstring2.default)(code);
|
|
328
330
|
const { descriptor, errors } = _compilersfc.parse.call(void 0, code);
|
|
329
331
|
const localStyleCollector = options.enableComponentLocalStyle && shouldEnableComponentLocalStyle(id) ? new UniAppXComponentLocalStyleCollector(id, runtimeSet) : void 0;
|
|
330
332
|
if (errors.length === 0) {
|
|
331
|
-
if (_optionalChain([descriptor, 'access',
|
|
333
|
+
if (_optionalChain([descriptor, 'access', _10 => _10.template, 'optionalAccess', _11 => _11.ast])) {
|
|
332
334
|
traverse2(descriptor.template.ast, (node) => {
|
|
333
335
|
if (node.type !== _compilerdom.NodeTypes.ELEMENT) {
|
|
334
336
|
return;
|
|
@@ -353,7 +355,7 @@ function transformUVue(code, id, jsHandler, runtimeSet, options = {}) {
|
|
|
353
355
|
if (shouldHandleDefault) {
|
|
354
356
|
continue;
|
|
355
357
|
}
|
|
356
|
-
} 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) {
|
|
357
359
|
const attrName = prop.arg.content;
|
|
358
360
|
const { shouldHandle } = shouldHandleAttribute(
|
|
359
361
|
tag,
|
|
@@ -380,7 +382,7 @@ function transformUVue(code, id, jsHandler, runtimeSet, options = {}) {
|
|
|
380
382
|
});
|
|
381
383
|
}
|
|
382
384
|
if (descriptor.script) {
|
|
383
|
-
_optionalChain([localStyleCollector, 'optionalAccess',
|
|
385
|
+
_optionalChain([localStyleCollector, 'optionalAccess', _14 => _14.collectRuntimeClasses, 'call', _15 => _15(descriptor.script.content)]);
|
|
384
386
|
const { code: code2 } = jsHandler(descriptor.script.content, _nullishCoalesce(runtimeSet, () => ( /* @__PURE__ */ new Set())), defaultCreateJsHandlerOptions);
|
|
385
387
|
ms.update(
|
|
386
388
|
descriptor.script.loc.start.offset,
|
|
@@ -389,7 +391,7 @@ function transformUVue(code, id, jsHandler, runtimeSet, options = {}) {
|
|
|
389
391
|
);
|
|
390
392
|
}
|
|
391
393
|
if (descriptor.scriptSetup) {
|
|
392
|
-
_optionalChain([localStyleCollector, 'optionalAccess',
|
|
394
|
+
_optionalChain([localStyleCollector, 'optionalAccess', _16 => _16.collectRuntimeClasses, 'call', _17 => _17(descriptor.scriptSetup.content)]);
|
|
393
395
|
const { code: code2 } = jsHandler(descriptor.scriptSetup.content, _nullishCoalesce(runtimeSet, () => ( /* @__PURE__ */ new Set())), defaultCreateJsHandlerOptions);
|
|
394
396
|
ms.update(
|
|
395
397
|
descriptor.scriptSetup.loc.start.offset,
|
|
@@ -397,13 +399,14 @@ function transformUVue(code, id, jsHandler, runtimeSet, options = {}) {
|
|
|
397
399
|
localStyleCollector ? localStyleCollector.rewriteTransformedCode(code2) : code2
|
|
398
400
|
);
|
|
399
401
|
}
|
|
400
|
-
if (_optionalChain([localStyleCollector, 'optionalAccess',
|
|
402
|
+
if (_optionalChain([localStyleCollector, 'optionalAccess', _18 => _18.hasStyles, 'call', _19 => _19()])) {
|
|
401
403
|
ms.append(`
|
|
402
404
|
${localStyleCollector.toStyleBlock()}`);
|
|
403
405
|
}
|
|
404
406
|
}
|
|
405
407
|
const result = {
|
|
406
|
-
code: ms.toString()
|
|
408
|
+
code: ms.toString(),
|
|
409
|
+
map: null
|
|
407
410
|
};
|
|
408
411
|
Object.defineProperty(result, "map", {
|
|
409
412
|
configurable: true,
|
|
@@ -500,7 +503,7 @@ function resolveUniAppXStyleIsolationEnabled(root) {
|
|
|
500
503
|
try {
|
|
501
504
|
const raw = _fs2.default.readFileSync(manifestPath, "utf8");
|
|
502
505
|
const manifest = _commentjson.parse.call(void 0, raw);
|
|
503
|
-
enabled = `${_nullishCoalesce(_optionalChain([manifest, 'access',
|
|
506
|
+
enabled = `${_nullishCoalesce(_optionalChain([manifest, 'access', _20 => _20["uni-app-x"], 'optionalAccess', _21 => _21.styleIsolationVersion]), () => ( ""))}` === "2";
|
|
504
507
|
} catch (e3) {
|
|
505
508
|
enabled = false;
|
|
506
509
|
}
|
|
@@ -515,7 +518,7 @@ var PREPROCESSOR_EXT_RE = /\.(?:scss|sass|less|styl|stylus)(?:\?|$)/i;
|
|
|
515
518
|
var UVUE_NVUE_QUERY_RE = /\.(?:uvue|nvue)(?:\?.*)?$/;
|
|
516
519
|
var UVUE_NVUE_RE2 = /\.(?:uvue|nvue)$/;
|
|
517
520
|
function isPreprocessorRequest(id, lang) {
|
|
518
|
-
const normalizedLang = _optionalChain([lang, 'optionalAccess',
|
|
521
|
+
const normalizedLang = _optionalChain([lang, 'optionalAccess', _22 => _22.toLowerCase, 'call', _23 => _23()]);
|
|
519
522
|
if (normalizedLang && preprocessorLangs.has(normalizedLang)) {
|
|
520
523
|
return true;
|
|
521
524
|
}
|
|
@@ -528,6 +531,9 @@ function isPreprocessorRequest(id, lang) {
|
|
|
528
531
|
function resolveUniAppXCssTarget(id) {
|
|
529
532
|
return UVUE_NVUE_RE2.test(_shared.cleanUrl.call(void 0, id)) ? "uvue" : void 0;
|
|
530
533
|
}
|
|
534
|
+
function resolveUniAppXJsTransformEnabled(uniAppX) {
|
|
535
|
+
return uniAppX === void 0 ? true : _chunkZAA5ZG3Djs.isUniAppXEnabled.call(void 0, uniAppX);
|
|
536
|
+
}
|
|
531
537
|
function createUniAppXPlugins(options) {
|
|
532
538
|
const {
|
|
533
539
|
appType,
|
|
@@ -542,7 +548,7 @@ function createUniAppXPlugins(options) {
|
|
|
542
548
|
getResolvedConfig,
|
|
543
549
|
uniAppX
|
|
544
550
|
} = options;
|
|
545
|
-
const resolvedUniAppXOptions =
|
|
551
|
+
const resolvedUniAppXOptions = _chunkZAA5ZG3Djs.resolveUniAppXOptions.call(void 0, uniAppX);
|
|
546
552
|
const isIosPlatform = _nullishCoalesce(providedIosPlatform, () => ( _chunkDYLQ6UOIjs.resolveUniUtsPlatform.call(void 0, ).isAppIos));
|
|
547
553
|
const cssHandlerOptionsCache = /* @__PURE__ */ new Map();
|
|
548
554
|
let componentLocalStyleEnabled;
|
|
@@ -558,7 +564,7 @@ function createUniAppXPlugins(options) {
|
|
|
558
564
|
if (componentLocalStyleEnabled !== void 0) {
|
|
559
565
|
return componentLocalStyleEnabled;
|
|
560
566
|
}
|
|
561
|
-
const root = _optionalChain([getResolvedConfig, 'call',
|
|
567
|
+
const root = _optionalChain([getResolvedConfig, 'call', _24 => _24(), 'optionalAccess', _25 => _25.root]);
|
|
562
568
|
componentLocalStyleEnabled = resolveUniAppXStyleIsolationEnabled(root);
|
|
563
569
|
return componentLocalStyleEnabled;
|
|
564
570
|
}
|
|
@@ -590,7 +596,7 @@ function createUniAppXPlugins(options) {
|
|
|
590
596
|
const postcssResult = await styleHandler(code, styleHandlerOptions);
|
|
591
597
|
const warnings = typeof postcssResult.warnings === "function" ? postcssResult.warnings() : [];
|
|
592
598
|
for (const warning of warnings) {
|
|
593
|
-
|
|
599
|
+
_chunkZAA5ZG3Djs.logger.warn(warning.toString());
|
|
594
600
|
}
|
|
595
601
|
const rawPostcssMap = postcssResult.map.toJSON();
|
|
596
602
|
const postcssMap = await formatPostcssSourceMap(
|
|
@@ -635,9 +641,9 @@ function createUniAppXPlugins(options) {
|
|
|
635
641
|
return;
|
|
636
642
|
}
|
|
637
643
|
const resolvedConfig = getResolvedConfig();
|
|
638
|
-
const isServeCommand = _optionalChain([resolvedConfig, 'optionalAccess',
|
|
639
|
-
const isWatchBuild = _optionalChain([resolvedConfig, 'optionalAccess',
|
|
640
|
-
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]);
|
|
641
647
|
const shouldForceRefresh = isServeCommand || isWatchBuild || isNonWatchBuild;
|
|
642
648
|
const currentRuntimeSet = shouldForceRefresh ? await ensureRuntimeClassSet(true) : await ensureRuntimeClassSet();
|
|
643
649
|
const extraOptions = customAttributesEntities.length > 0 || disabledDefaultTemplateHandler ? {
|
|
@@ -657,7 +663,7 @@ function createUniAppXPlugins(options) {
|
|
|
657
663
|
},
|
|
658
664
|
async handleHotUpdate(ctx) {
|
|
659
665
|
const resolvedConfig = getResolvedConfig();
|
|
660
|
-
if (_optionalChain([resolvedConfig, 'optionalAccess',
|
|
666
|
+
if (_optionalChain([resolvedConfig, 'optionalAccess', _33 => _33.command]) !== "serve") {
|
|
661
667
|
return;
|
|
662
668
|
}
|
|
663
669
|
if (!UVUE_NVUE_RE2.test(ctx.file)) {
|
|
@@ -667,7 +673,7 @@ function createUniAppXPlugins(options) {
|
|
|
667
673
|
},
|
|
668
674
|
async watchChange(id) {
|
|
669
675
|
const resolvedConfig = getResolvedConfig();
|
|
670
|
-
if (_optionalChain([resolvedConfig, 'optionalAccess',
|
|
676
|
+
if (_optionalChain([resolvedConfig, 'optionalAccess', _34 => _34.command]) !== "build" || !_optionalChain([resolvedConfig, 'access', _35 => _35.build, 'optionalAccess', _36 => _36.watch])) {
|
|
671
677
|
return;
|
|
672
678
|
}
|
|
673
679
|
if (!UVUE_NVUE_QUERY_RE.test(id)) {
|
|
@@ -693,7 +699,7 @@ function createUniAppXAssetTask(file, originalSource, outDir, options) {
|
|
|
693
699
|
runtimeSet,
|
|
694
700
|
applyLinkedResults: applyLinkedResults2
|
|
695
701
|
} = options;
|
|
696
|
-
const absoluteFile =
|
|
702
|
+
const absoluteFile = _chunk24AGZQVRjs.toAbsoluteOutputPath.call(void 0, file, outDir);
|
|
697
703
|
const rawSource = originalSource.source.toString();
|
|
698
704
|
const rawHashSource = options.hashSalt ? `${rawSource}
|
|
699
705
|
/*${options.hashSalt}*/` : rawSource;
|
|
@@ -711,7 +717,7 @@ function createUniAppXAssetTask(file, originalSource, outDir, options) {
|
|
|
711
717
|
async transform() {
|
|
712
718
|
const currentSource = originalSource.source.toString();
|
|
713
719
|
const { code, linked } = await jsHandler(currentSource, runtimeSet, createHandlerOptions(absoluteFile, {
|
|
714
|
-
uniAppX:
|
|
720
|
+
uniAppX: resolveUniAppXJsTransformEnabled(options.uniAppX),
|
|
715
721
|
babelParserOptions: {
|
|
716
722
|
plugins: [
|
|
717
723
|
"typescript"
|
|
@@ -767,12 +773,12 @@ function isJavaScriptEntry(entry) {
|
|
|
767
773
|
function createBundleModuleGraphOptions(outputDir, entries) {
|
|
768
774
|
const normalizedEntries = /* @__PURE__ */ new Map();
|
|
769
775
|
for (const [id, entry] of entries) {
|
|
770
|
-
normalizedEntries.set(
|
|
776
|
+
normalizedEntries.set(_chunk24AGZQVRjs.normalizeOutputPathKey.call(void 0, id), entry);
|
|
771
777
|
}
|
|
772
|
-
const getEntry = (id) => _nullishCoalesce(entries.get(id), () => ( normalizedEntries.get(
|
|
778
|
+
const getEntry = (id) => _nullishCoalesce(entries.get(id), () => ( normalizedEntries.get(_chunk24AGZQVRjs.normalizeOutputPathKey.call(void 0, id))));
|
|
773
779
|
return {
|
|
774
780
|
resolve(specifier, importer) {
|
|
775
|
-
return
|
|
781
|
+
return _chunk24AGZQVRjs.resolveOutputSpecifier.call(void 0, specifier, importer, outputDir, (candidate) => Boolean(getEntry(candidate)));
|
|
776
782
|
},
|
|
777
783
|
load(id) {
|
|
778
784
|
const entry = getEntry(id);
|
|
@@ -792,10 +798,10 @@ function applyLinkedResults(linked, entries, onLinkedUpdate, onApplied) {
|
|
|
792
798
|
}
|
|
793
799
|
const normalizedEntries = /* @__PURE__ */ new Map();
|
|
794
800
|
for (const [entryId, entry] of entries) {
|
|
795
|
-
normalizedEntries.set(
|
|
801
|
+
normalizedEntries.set(_chunk24AGZQVRjs.normalizeOutputPathKey.call(void 0, entryId), entry);
|
|
796
802
|
}
|
|
797
803
|
for (const [id, { code }] of Object.entries(linked)) {
|
|
798
|
-
const entry = _nullishCoalesce(entries.get(id), () => ( normalizedEntries.get(
|
|
804
|
+
const entry = _nullishCoalesce(entries.get(id), () => ( normalizedEntries.get(_chunk24AGZQVRjs.normalizeOutputPathKey.call(void 0, id))));
|
|
799
805
|
if (!entry) {
|
|
800
806
|
continue;
|
|
801
807
|
}
|
|
@@ -808,7 +814,7 @@ function applyLinkedResults(linked, entries, onLinkedUpdate, onApplied) {
|
|
|
808
814
|
} else {
|
|
809
815
|
entry.output.source = code;
|
|
810
816
|
}
|
|
811
|
-
_optionalChain([onApplied, 'optionalCall',
|
|
817
|
+
_optionalChain([onApplied, 'optionalCall', _37 => _37(entry, code)]);
|
|
812
818
|
onLinkedUpdate(entry.fileName, previous, code);
|
|
813
819
|
}
|
|
814
820
|
}
|
|
@@ -850,14 +856,14 @@ function createHtmlRuntimeAffectingSignature(source) {
|
|
|
850
856
|
}
|
|
851
857
|
function createJsRuntimeAffectingSignature(source) {
|
|
852
858
|
try {
|
|
853
|
-
const ast =
|
|
859
|
+
const ast = _chunkHVNGIKLSjs.babelParse.call(void 0, source, {
|
|
854
860
|
cache: true,
|
|
855
861
|
cacheKey: "vite-runtime-affecting:unambiguous",
|
|
856
862
|
plugins: ["jsx", "typescript"],
|
|
857
863
|
sourceType: "unambiguous"
|
|
858
864
|
});
|
|
859
865
|
const parts = [];
|
|
860
|
-
|
|
866
|
+
_chunkHVNGIKLSjs.traverse.call(void 0, ast, {
|
|
861
867
|
noScope: true,
|
|
862
868
|
StringLiteral(path7) {
|
|
863
869
|
parts.push(`s:${path7.node.value}`);
|
|
@@ -875,7 +881,7 @@ function createJsRuntimeAffectingSignature(source) {
|
|
|
875
881
|
const comments = ast.comments;
|
|
876
882
|
if (Array.isArray(comments)) {
|
|
877
883
|
for (const comment of comments) {
|
|
878
|
-
if (typeof _optionalChain([comment, 'optionalAccess',
|
|
884
|
+
if (typeof _optionalChain([comment, 'optionalAccess', _38 => _38.value]) === "string" && comment.value.length > 0) {
|
|
879
885
|
parts.push(`c:${comment.value}`);
|
|
880
886
|
}
|
|
881
887
|
}
|
|
@@ -906,6 +912,7 @@ function createBundleBuildState() {
|
|
|
906
912
|
return {
|
|
907
913
|
iteration: 0,
|
|
908
914
|
sourceHashByFile: /* @__PURE__ */ new Map(),
|
|
915
|
+
runtimeAffectingSignatureByFile: /* @__PURE__ */ new Map(),
|
|
909
916
|
runtimeAffectingHashByFile: /* @__PURE__ */ new Map(),
|
|
910
917
|
linkedByEntry: /* @__PURE__ */ new Map(),
|
|
911
918
|
dependentsByLinkedFile: /* @__PURE__ */ new Map()
|
|
@@ -949,7 +956,7 @@ function collectJsEntries(fileName, output, outDir, store) {
|
|
|
949
956
|
if (!isJavaScriptEntry(entry)) {
|
|
950
957
|
return;
|
|
951
958
|
}
|
|
952
|
-
const absolute =
|
|
959
|
+
const absolute = _chunk24AGZQVRjs.toAbsoluteOutputPath.call(void 0, fileName, outDir);
|
|
953
960
|
store.set(absolute, entry);
|
|
954
961
|
}
|
|
955
962
|
function markProcessFile(type, file, processFiles) {
|
|
@@ -973,16 +980,18 @@ function buildBundleSnapshot(bundle, opts, outDir, state, forceAll = false) {
|
|
|
973
980
|
const source = readEntrySource(output);
|
|
974
981
|
const hash = opts.cache.computeHash(source);
|
|
975
982
|
sourceHashByFile.set(file, hash);
|
|
976
|
-
const runtimeAffectingSignature = createRuntimeAffectingSourceSignature(source, type);
|
|
977
|
-
runtimeAffectingSignatureByFile.set(file, runtimeAffectingSignature);
|
|
978
|
-
const runtimeAffectingHash = opts.cache.computeHash(runtimeAffectingSignature);
|
|
979
|
-
runtimeAffectingHashByFile.set(file, runtimeAffectingHash);
|
|
980
983
|
const previousHash = state.sourceHashByFile.get(file);
|
|
981
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);
|
|
982
992
|
if (changed) {
|
|
983
993
|
changedByType[type].add(file);
|
|
984
994
|
}
|
|
985
|
-
const previousRuntimeAffectingHash = state.runtimeAffectingHashByFile.get(file);
|
|
986
995
|
const runtimeAffectingChanged = previousRuntimeAffectingHash == null || previousRuntimeAffectingHash !== runtimeAffectingHash;
|
|
987
996
|
if (runtimeAffectingChanged) {
|
|
988
997
|
runtimeAffectingChangedByType[type].add(file);
|
|
@@ -1052,6 +1061,7 @@ function updateBundleBuildState(state, snapshot, linkedByEntry, options = {}) {
|
|
|
1052
1061
|
...state.sourceHashByFile,
|
|
1053
1062
|
...snapshot.sourceHashByFile
|
|
1054
1063
|
]) : snapshot.sourceHashByFile;
|
|
1064
|
+
state.runtimeAffectingSignatureByFile = incremental ? new Map([...state.runtimeAffectingSignatureByFile, ...snapshot.runtimeAffectingSignatureByFile]) : snapshot.runtimeAffectingSignatureByFile;
|
|
1055
1065
|
state.runtimeAffectingHashByFile = incremental ? new Map([
|
|
1056
1066
|
...state.runtimeAffectingHashByFile,
|
|
1057
1067
|
...snapshot.runtimeAffectingHashByFile
|
|
@@ -1093,6 +1103,9 @@ function createEmptyMetrics() {
|
|
|
1093
1103
|
function measureElapsed(start) {
|
|
1094
1104
|
return performance.now() - start;
|
|
1095
1105
|
}
|
|
1106
|
+
function resolveUniAppXJsTransformEnabled2(uniAppX) {
|
|
1107
|
+
return uniAppX === void 0 ? true : _chunkZAA5ZG3Djs.isUniAppXEnabled.call(void 0, uniAppX);
|
|
1108
|
+
}
|
|
1096
1109
|
function formatCacheHitRate(metric) {
|
|
1097
1110
|
if (metric.total === 0) {
|
|
1098
1111
|
return "0.00%";
|
|
@@ -1140,11 +1153,36 @@ function createJsHashSalt(runtimeSignature, linkedImpactSignature) {
|
|
|
1140
1153
|
}
|
|
1141
1154
|
return `${runtimeSignature}:linked:${linkedImpactSignature}`;
|
|
1142
1155
|
}
|
|
1156
|
+
function getSnapshotHash(snapshotMap, file, fallback) {
|
|
1157
|
+
return _nullishCoalesce(snapshotMap.get(file), () => ( fallback));
|
|
1158
|
+
}
|
|
1143
1159
|
function hasRuntimeAffectingSourceChanges(changedByType) {
|
|
1144
1160
|
return changedByType.html.size > 0 || changedByType.js.size > 0;
|
|
1145
1161
|
}
|
|
1146
|
-
|
|
1147
|
-
|
|
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";
|
|
1148
1186
|
}
|
|
1149
1187
|
function hasOmittedKnownBundleFiles(currentBundleFiles, previousBundleFiles) {
|
|
1150
1188
|
const currentFileSet = new Set(currentBundleFiles);
|
|
@@ -1232,10 +1270,10 @@ function createGenerateBundleHook(context) {
|
|
|
1232
1270
|
const debugCssDiff = _process2.default.env.WEAPP_TW_VITE_DEBUG_CSS_DIFF === "1";
|
|
1233
1271
|
const resolvedConfig = getResolvedConfig();
|
|
1234
1272
|
const bundleFiles = Object.keys(bundle);
|
|
1235
|
-
const buildCommand = _optionalChain([resolvedConfig, 'optionalAccess',
|
|
1273
|
+
const buildCommand = _optionalChain([resolvedConfig, 'optionalAccess', _39 => _39.command]) === "build";
|
|
1236
1274
|
const useIncrementalMode = !buildCommand || hasOmittedKnownBundleFiles(bundleFiles, state.sourceHashByFile.keys());
|
|
1237
|
-
const rootDir = _optionalChain([resolvedConfig, 'optionalAccess',
|
|
1238
|
-
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;
|
|
1239
1277
|
const snapshot = buildBundleSnapshot(bundle, opts, outDir, state, disableDirtyOptimization || !useIncrementalMode);
|
|
1240
1278
|
const useBundleRuntimeClassSet = useIncrementalMode || runtimeState.twPatcher.majorVersion === 4;
|
|
1241
1279
|
const forceRuntimeRefreshBySource = useIncrementalMode && hasRuntimeAffectingSourceChanges(snapshot.runtimeAffectingChangedByType);
|
|
@@ -1277,9 +1315,9 @@ function createGenerateBundleHook(context) {
|
|
|
1277
1315
|
const jsEntries = snapshot.jsEntries;
|
|
1278
1316
|
const normalizedJsEntries = /* @__PURE__ */ new Map();
|
|
1279
1317
|
for (const [id, entry] of jsEntries) {
|
|
1280
|
-
normalizedJsEntries.set(
|
|
1318
|
+
normalizedJsEntries.set(_chunk24AGZQVRjs.normalizeOutputPathKey.call(void 0, id), entry);
|
|
1281
1319
|
}
|
|
1282
|
-
const getJsEntry = (id) => _nullishCoalesce(jsEntries.get(id), () => ( normalizedJsEntries.get(
|
|
1320
|
+
const getJsEntry = (id) => _nullishCoalesce(jsEntries.get(id), () => ( normalizedJsEntries.get(_chunk24AGZQVRjs.normalizeOutputPathKey.call(void 0, id))));
|
|
1283
1321
|
const moduleGraphOptions = createBundleModuleGraphOptions(outDir, jsEntries);
|
|
1284
1322
|
const runtimeStart = performance.now();
|
|
1285
1323
|
const runtime = useBundleRuntimeClassSet ? await ensureBundleRuntimeClassSet(snapshot, forceRuntimeRefreshByEnv) : await context.ensureRuntimeClassSet(forceRuntimeRefreshByEnv);
|
|
@@ -1295,7 +1333,7 @@ function createGenerateBundleHook(context) {
|
|
|
1295
1333
|
);
|
|
1296
1334
|
}
|
|
1297
1335
|
debug3("get runtimeSet, class count: %d", runtime.size);
|
|
1298
|
-
const runtimeSignature = _nullishCoalesce(
|
|
1336
|
+
const runtimeSignature = _nullishCoalesce(_chunkZAA5ZG3Djs.getRuntimeClassSetSignature.call(void 0, runtimeState.twPatcher), () => ( "runtime:missing"));
|
|
1299
1337
|
const handleLinkedUpdate = (fileName, previous, next) => {
|
|
1300
1338
|
onUpdate(fileName, previous, next);
|
|
1301
1339
|
debug3("js linked handle: %s", fileName);
|
|
@@ -1319,7 +1357,7 @@ function createGenerateBundleHook(context) {
|
|
|
1319
1357
|
tailwindcssMajorVersion: runtimeState.twPatcher.majorVersion,
|
|
1320
1358
|
moduleGraph: moduleGraphOptions,
|
|
1321
1359
|
babelParserOptions: {
|
|
1322
|
-
..._nullishCoalesce(_optionalChain([extra, 'optionalAccess',
|
|
1360
|
+
..._nullishCoalesce(_optionalChain([extra, 'optionalAccess', _43 => _43.babelParserOptions]), () => ( {})),
|
|
1323
1361
|
sourceFilename: absoluteFilename
|
|
1324
1362
|
}
|
|
1325
1363
|
});
|
|
@@ -1339,8 +1377,8 @@ function createGenerateBundleHook(context) {
|
|
|
1339
1377
|
_chunkOF6MFURRjs.processCachedTask.call(void 0, {
|
|
1340
1378
|
cache,
|
|
1341
1379
|
cacheKey: file,
|
|
1342
|
-
rawSource,
|
|
1343
1380
|
hashKey: `${file}:html:${runtimeSignature}`,
|
|
1381
|
+
hash: getSnapshotHash(snapshot.sourceHashByFile, file, rawSource),
|
|
1344
1382
|
applyResult(source) {
|
|
1345
1383
|
originalSource.source = source;
|
|
1346
1384
|
},
|
|
@@ -1387,14 +1425,15 @@ function createGenerateBundleHook(context) {
|
|
|
1387
1425
|
metrics.css.total++;
|
|
1388
1426
|
const rawSource = originalEntrySource;
|
|
1389
1427
|
const cssRuntimeAffectingSignature = _nullishCoalesce(snapshot.runtimeAffectingSignatureByFile.get(file), () => ( rawSource));
|
|
1390
|
-
const
|
|
1391
|
-
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}`;
|
|
1392
1431
|
tasks.push(
|
|
1393
1432
|
_chunkOF6MFURRjs.processCachedTask.call(void 0, {
|
|
1394
1433
|
cache,
|
|
1395
1434
|
cacheKey: file,
|
|
1396
1435
|
hashKey: `${file}:css:${runtimeSignature}:${_nullishCoalesce(runtimeState.twPatcher.majorVersion, () => ( "unknown"))}`,
|
|
1397
|
-
|
|
1436
|
+
hash: getSnapshotHash(snapshot.runtimeAffectingHashByFile, file, cssRuntimeAffectingSignature),
|
|
1398
1437
|
applyResult(source) {
|
|
1399
1438
|
originalSource.source = source;
|
|
1400
1439
|
},
|
|
@@ -1467,8 +1506,7 @@ function createGenerateBundleHook(context) {
|
|
|
1467
1506
|
cache,
|
|
1468
1507
|
cacheKey: file,
|
|
1469
1508
|
hashKey: `${file}:js`,
|
|
1470
|
-
|
|
1471
|
-
/*${hashSalt}*/`,
|
|
1509
|
+
hash: `${getSnapshotHash(snapshot.sourceHashByFile, file, initialRawSource)}:${hashSalt}`,
|
|
1472
1510
|
applyResult(source) {
|
|
1473
1511
|
originalSource.code = source;
|
|
1474
1512
|
},
|
|
@@ -1483,7 +1521,7 @@ function createGenerateBundleHook(context) {
|
|
|
1483
1521
|
debug3("js cache replay miss, fallback transform: %s", file);
|
|
1484
1522
|
}
|
|
1485
1523
|
const handlerOptions = createHandlerOptions(absoluteFile);
|
|
1486
|
-
if (!disableJsPrecheck &&
|
|
1524
|
+
if (!disableJsPrecheck && _chunkHVNGIKLSjs.shouldSkipJsTransform.call(void 0, rawSource, handlerOptions)) {
|
|
1487
1525
|
metrics.js.elapsed += measureElapsed(start);
|
|
1488
1526
|
metrics.js.transformed++;
|
|
1489
1527
|
return {
|
|
@@ -1563,13 +1601,13 @@ function createGenerateBundleHook(context) {
|
|
|
1563
1601
|
const currentSource = originalEntrySource;
|
|
1564
1602
|
const absoluteFile = _path2.default.resolve(outDir, file);
|
|
1565
1603
|
const precheckOptions = createHandlerOptions(absoluteFile, {
|
|
1566
|
-
uniAppX:
|
|
1604
|
+
uniAppX: resolveUniAppXJsTransformEnabled2(uniAppX),
|
|
1567
1605
|
babelParserOptions: {
|
|
1568
1606
|
plugins: ["typescript"],
|
|
1569
1607
|
sourceType: "unambiguous"
|
|
1570
1608
|
}
|
|
1571
1609
|
});
|
|
1572
|
-
if (!disableJsPrecheck &&
|
|
1610
|
+
if (!disableJsPrecheck && _chunkHVNGIKLSjs.shouldSkipJsTransform.call(void 0, currentSource, precheckOptions)) {
|
|
1573
1611
|
metrics.js.elapsed += measureElapsed(start);
|
|
1574
1612
|
metrics.js.transformed++;
|
|
1575
1613
|
return;
|
|
@@ -1580,7 +1618,7 @@ function createGenerateBundleHook(context) {
|
|
|
1580
1618
|
});
|
|
1581
1619
|
}
|
|
1582
1620
|
}
|
|
1583
|
-
|
|
1621
|
+
_chunk24AGZQVRjs.pushConcurrentTaskFactories.call(void 0, tasks, jsTaskFactories);
|
|
1584
1622
|
await Promise.all(tasks);
|
|
1585
1623
|
for (const apply of pendingLinkedUpdates) {
|
|
1586
1624
|
apply();
|
|
@@ -1622,8 +1660,8 @@ var _module = require('module');
|
|
|
1622
1660
|
|
|
1623
1661
|
|
|
1624
1662
|
var _tailwindcsspatch = require('tailwindcss-patch');
|
|
1625
|
-
var debug =
|
|
1626
|
-
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);
|
|
1627
1665
|
var EXTENSION_DOT_PREFIX_RE = /^\./;
|
|
1628
1666
|
var VALIDATION_FILE_NAME = "runtime-candidates.html";
|
|
1629
1667
|
var tailwindNodeModulePromise;
|
|
@@ -1640,23 +1678,23 @@ function isPostcssPluginImportTarget(value) {
|
|
|
1640
1678
|
return value === "@tailwindcss/postcss" || value === "@tailwindcss/postcss7-compat" || value.includes("/postcss");
|
|
1641
1679
|
}
|
|
1642
1680
|
function resolveTailwindCssImportTarget(patcher) {
|
|
1643
|
-
const tailwindOptions =
|
|
1644
|
-
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)]);
|
|
1645
1683
|
if (cssEntries && cssEntries.length > 0) {
|
|
1646
1684
|
return createCssImportSource(cssEntries);
|
|
1647
1685
|
}
|
|
1648
|
-
const configuredPackageName = _optionalChain([tailwindOptions, 'optionalAccess',
|
|
1686
|
+
const configuredPackageName = _optionalChain([tailwindOptions, 'optionalAccess', _48 => _48.packageName]);
|
|
1649
1687
|
if (typeof configuredPackageName === "string" && configuredPackageName.length > 0 && !isPostcssPluginImportTarget(configuredPackageName)) {
|
|
1650
1688
|
return createCssImportSource([configuredPackageName]);
|
|
1651
1689
|
}
|
|
1652
|
-
const packageName = _optionalChain([patcher, 'access',
|
|
1690
|
+
const packageName = _optionalChain([patcher, 'access', _49 => _49.packageInfo, 'optionalAccess', _50 => _50.name]);
|
|
1653
1691
|
if (typeof packageName === "string" && packageName.length > 0 && !isPostcssPluginImportTarget(packageName)) {
|
|
1654
1692
|
return createCssImportSource([packageName]);
|
|
1655
1693
|
}
|
|
1656
1694
|
return createCssImportSource(["tailwindcss"]);
|
|
1657
1695
|
}
|
|
1658
1696
|
function getProjectRoot(patcher) {
|
|
1659
|
-
return _nullishCoalesce(_optionalChain([patcher, 'access',
|
|
1697
|
+
return _nullishCoalesce(_optionalChain([patcher, 'access', _51 => _51.options, 'optionalAccess', _52 => _52.projectRoot]), () => ( _process2.default.cwd()));
|
|
1660
1698
|
}
|
|
1661
1699
|
async function importTailwindNodeModule() {
|
|
1662
1700
|
if (!tailwindNodeModulePromise) {
|
|
@@ -1683,16 +1721,16 @@ function resolveMaybeAbsolute(base, value) {
|
|
|
1683
1721
|
}
|
|
1684
1722
|
async function resolveTailwindCssSource(patcher) {
|
|
1685
1723
|
const projectRoot = getProjectRoot(patcher);
|
|
1686
|
-
const tailwindOptions =
|
|
1687
|
-
const configuredBase = resolveMaybeAbsolute(projectRoot, _optionalChain([tailwindOptions, 'optionalAccess',
|
|
1688
|
-
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;
|
|
1689
1727
|
const sharedFallbacks = [
|
|
1690
1728
|
configuredBase,
|
|
1691
1729
|
projectRoot,
|
|
1692
|
-
_optionalChain([tailwindOptions, 'optionalAccess',
|
|
1730
|
+
_optionalChain([tailwindOptions, 'optionalAccess', _56 => _56.cwd]),
|
|
1693
1731
|
configDir
|
|
1694
1732
|
].filter((item) => typeof item === "string" && item.length > 0);
|
|
1695
|
-
if (_optionalChain([tailwindOptions, 'optionalAccess',
|
|
1733
|
+
if (_optionalChain([tailwindOptions, 'optionalAccess', _57 => _57.v4, 'optionalAccess', _58 => _58.css])) {
|
|
1696
1734
|
return {
|
|
1697
1735
|
projectRoot,
|
|
1698
1736
|
base: _nullishCoalesce(configuredBase, () => ( projectRoot)),
|
|
@@ -1700,7 +1738,7 @@ async function resolveTailwindCssSource(patcher) {
|
|
|
1700
1738
|
css: tailwindOptions.v4.css
|
|
1701
1739
|
};
|
|
1702
1740
|
}
|
|
1703
|
-
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)]), () => ( []));
|
|
1704
1742
|
if (cssEntries.length > 0) {
|
|
1705
1743
|
const resolvedEntries = cssEntries.map((entry) => _nullishCoalesce(resolveMaybeAbsolute(projectRoot, entry), () => ( entry)));
|
|
1706
1744
|
const cssChunks = [];
|
|
@@ -1881,7 +1919,7 @@ function createBundleRuntimeClassSetManager(options = {}) {
|
|
|
1881
1919
|
const matches = await extractRawCandidates(entry.source, resolveEntryExtension(entry));
|
|
1882
1920
|
const candidates = /* @__PURE__ */ new Set();
|
|
1883
1921
|
for (const match of matches) {
|
|
1884
|
-
const candidate = _optionalChain([match, 'optionalAccess',
|
|
1922
|
+
const candidate = _optionalChain([match, 'optionalAccess', _63 => _63.rawCandidate]);
|
|
1885
1923
|
if (typeof candidate === "string" && candidate.length > 0) {
|
|
1886
1924
|
candidates.add(candidate);
|
|
1887
1925
|
}
|
|
@@ -1889,7 +1927,7 @@ function createBundleRuntimeClassSetManager(options = {}) {
|
|
|
1889
1927
|
return candidates;
|
|
1890
1928
|
}
|
|
1891
1929
|
async function sync(patcher, snapshot) {
|
|
1892
|
-
const nextSignature = _nullishCoalesce(
|
|
1930
|
+
const nextSignature = _nullishCoalesce(_chunkZAA5ZG3Djs.getRuntimeClassSetSignature.call(void 0, patcher), () => ( "runtime:missing"));
|
|
1893
1931
|
const runtimeEntries = createRuntimeEntries(snapshot);
|
|
1894
1932
|
const runtimeEntriesByFile = new Map(runtimeEntries.map((entry) => [entry.file, entry]));
|
|
1895
1933
|
const currentRuntimeFiles = new Set(runtimeEntriesByFile.keys());
|
|
@@ -2087,15 +2125,15 @@ function createRewriteCssImportsPlugins(options) {
|
|
|
2087
2125
|
return [];
|
|
2088
2126
|
}
|
|
2089
2127
|
const { appType, getAppType, weappTailwindcssDirPosix: weappTailwindcssDirPosix2 } = options;
|
|
2090
|
-
const resolveAppType = () => _nullishCoalesce(_optionalChain([getAppType, 'optionalCall',
|
|
2128
|
+
const resolveAppType = () => _nullishCoalesce(_optionalChain([getAppType, 'optionalCall', _64 => _64()]), () => ( appType));
|
|
2091
2129
|
return [
|
|
2092
2130
|
{
|
|
2093
|
-
name: `${
|
|
2131
|
+
name: `${_chunkHVNGIKLSjs.vitePluginName}:rewrite-css-imports`,
|
|
2094
2132
|
enforce: "pre",
|
|
2095
2133
|
resolveId: {
|
|
2096
2134
|
order: "pre",
|
|
2097
2135
|
handler(id, importer) {
|
|
2098
|
-
const replacement =
|
|
2136
|
+
const replacement = _chunk24AGZQVRjs.resolveTailwindcssImport.call(void 0, id, weappTailwindcssDirPosix2, {
|
|
2099
2137
|
join: joinPosixPath,
|
|
2100
2138
|
appType: resolveAppType()
|
|
2101
2139
|
});
|
|
@@ -2114,7 +2152,7 @@ function createRewriteCssImportsPlugins(options) {
|
|
|
2114
2152
|
if (!isCSSRequest(id)) {
|
|
2115
2153
|
return null;
|
|
2116
2154
|
}
|
|
2117
|
-
const rewritten =
|
|
2155
|
+
const rewritten = _chunk24AGZQVRjs.rewriteTailwindcssImportsInCode.call(void 0, code, weappTailwindcssDirPosix2, {
|
|
2118
2156
|
join: joinPosixPath,
|
|
2119
2157
|
appType: resolveAppType()
|
|
2120
2158
|
});
|
|
@@ -2132,8 +2170,8 @@ function createRewriteCssImportsPlugins(options) {
|
|
|
2132
2170
|
}
|
|
2133
2171
|
|
|
2134
2172
|
// src/bundlers/vite/index.ts
|
|
2135
|
-
var debug2 =
|
|
2136
|
-
var weappTailwindcssPackageDir =
|
|
2173
|
+
var debug2 = _chunkHVNGIKLSjs.createDebug.call(void 0, );
|
|
2174
|
+
var weappTailwindcssPackageDir = _chunk24AGZQVRjs.resolvePackageDir.call(void 0, "weapp-tailwindcss");
|
|
2137
2175
|
var weappTailwindcssDirPosix = slash(weappTailwindcssPackageDir);
|
|
2138
2176
|
var PACKAGE_JSON_FILE2 = "package.json";
|
|
2139
2177
|
function getPostcssPluginName(plugin) {
|
|
@@ -2158,11 +2196,11 @@ function resolveImplicitTailwindcssBasedirFromViteRoot(root) {
|
|
|
2158
2196
|
}
|
|
2159
2197
|
current = parent;
|
|
2160
2198
|
}
|
|
2161
|
-
const tailwindConfigPath =
|
|
2199
|
+
const tailwindConfigPath = _chunkZAA5ZG3Djs.findTailwindConfig.call(void 0, searchRoots);
|
|
2162
2200
|
if (tailwindConfigPath) {
|
|
2163
2201
|
return _path2.default.dirname(tailwindConfigPath);
|
|
2164
2202
|
}
|
|
2165
|
-
const packageRoot =
|
|
2203
|
+
const packageRoot = _chunkZAA5ZG3Djs.findNearestPackageRoot.call(void 0, resolvedRoot);
|
|
2166
2204
|
if (packageRoot && _fs.existsSync.call(void 0, _path2.default.join(packageRoot, PACKAGE_JSON_FILE2))) {
|
|
2167
2205
|
return packageRoot;
|
|
2168
2206
|
}
|
|
@@ -2172,7 +2210,7 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
|
|
|
2172
2210
|
const hasExplicitAppType = typeof options.appType === "string" && options.appType.trim().length > 0;
|
|
2173
2211
|
const rewriteCssImportsSpecified = Object.hasOwn(options, "rewriteCssImports");
|
|
2174
2212
|
const hasExplicitTailwindcssBasedir = typeof options.tailwindcssBasedir === "string" && options.tailwindcssBasedir.trim().length > 0;
|
|
2175
|
-
const opts =
|
|
2213
|
+
const opts = _chunkHVNGIKLSjs.getCompilerContext.call(void 0, options);
|
|
2176
2214
|
const {
|
|
2177
2215
|
disabled,
|
|
2178
2216
|
customAttributes,
|
|
@@ -2185,8 +2223,8 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
|
|
|
2185
2223
|
uniAppX,
|
|
2186
2224
|
disabledDefaultTemplateHandler
|
|
2187
2225
|
} = opts;
|
|
2188
|
-
const uniAppXEnabled =
|
|
2189
|
-
const disabledOptions =
|
|
2226
|
+
const uniAppXEnabled = _chunkZAA5ZG3Djs.isUniAppXEnabled.call(void 0, uniAppX);
|
|
2227
|
+
const disabledOptions = _chunk24AGZQVRjs.resolveDisabledOptions.call(void 0, disabled);
|
|
2190
2228
|
const tailwindcssMajorVersion = _nullishCoalesce(initialTwPatcher.majorVersion, () => ( 0));
|
|
2191
2229
|
const shouldRewriteCssImports = opts.rewriteCssImports !== false && !disabledOptions.rewriteCssImports && (rewriteCssImportsSpecified || tailwindcssMajorVersion >= 4);
|
|
2192
2230
|
const rewritePlugins = createRewriteCssImportsPlugins({
|
|
@@ -2197,8 +2235,8 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
|
|
|
2197
2235
|
if (disabledOptions.plugin) {
|
|
2198
2236
|
return rewritePlugins.length ? rewritePlugins : void 0;
|
|
2199
2237
|
}
|
|
2200
|
-
const customAttributesEntities =
|
|
2201
|
-
const patchRecorderState =
|
|
2238
|
+
const customAttributesEntities = _chunkHVNGIKLSjs.toCustomAttributesEntities.call(void 0, customAttributes);
|
|
2239
|
+
const patchRecorderState = _chunkHVNGIKLSjs.setupPatchRecorder.call(void 0, initialTwPatcher, opts.tailwindcssBasedir, {
|
|
2202
2240
|
source: "runtime",
|
|
2203
2241
|
cwd: _nullishCoalesce(opts.tailwindcssBasedir, () => ( _process2.default.cwd()))
|
|
2204
2242
|
});
|
|
@@ -2215,8 +2253,8 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
|
|
|
2215
2253
|
let runtimeRefreshOptionsKey;
|
|
2216
2254
|
const bundleRuntimeClassSetManager = createBundleRuntimeClassSetManager();
|
|
2217
2255
|
function resolveRuntimeRefreshOptions() {
|
|
2218
|
-
const configPath = _optionalChain([
|
|
2219
|
-
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);
|
|
2220
2258
|
const optionsKey = JSON.stringify({
|
|
2221
2259
|
appType: opts.appType,
|
|
2222
2260
|
uniAppX: uniAppXEnabled,
|
|
@@ -2237,7 +2275,7 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
|
|
|
2237
2275
|
async function refreshRuntimeState(force) {
|
|
2238
2276
|
const invalidation = resolveRuntimeRefreshOptions();
|
|
2239
2277
|
const shouldRefresh = force || invalidation.changed;
|
|
2240
|
-
const refreshed = await
|
|
2278
|
+
const refreshed = await _chunkHVNGIKLSjs.refreshTailwindRuntimeState.call(void 0, runtimeState, {
|
|
2241
2279
|
force: shouldRefresh,
|
|
2242
2280
|
clearCache: force || invalidation.changed
|
|
2243
2281
|
});
|
|
@@ -2258,7 +2296,7 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
|
|
|
2258
2296
|
}
|
|
2259
2297
|
if (forceRuntimeRefresh || !runtimeSetPromise) {
|
|
2260
2298
|
const invalidation = resolveRuntimeRefreshOptions();
|
|
2261
|
-
const task2 =
|
|
2299
|
+
const task2 = _chunkHVNGIKLSjs.collectRuntimeClassSet.call(void 0, runtimeState.twPatcher, {
|
|
2262
2300
|
force: forceRuntimeRefresh || invalidation.changed,
|
|
2263
2301
|
skipRefresh: forceRuntimeRefresh,
|
|
2264
2302
|
clearCache: forceRuntimeRefresh || invalidation.changed
|
|
@@ -2300,7 +2338,7 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
|
|
|
2300
2338
|
if (!forceRuntimeRefresh && !invalidation.changed && !forceCollectBySource && runtimeSet) {
|
|
2301
2339
|
return runtimeSet;
|
|
2302
2340
|
}
|
|
2303
|
-
const task =
|
|
2341
|
+
const task = _chunkHVNGIKLSjs.collectRuntimeClassSet.call(void 0, runtimeState.twPatcher, {
|
|
2304
2342
|
force: forceRuntimeRefresh || invalidation.changed || forceCollectBySource,
|
|
2305
2343
|
skipRefresh: forceRuntimeRefresh,
|
|
2306
2344
|
clearCache: forceRuntimeRefresh || invalidation.changed
|
|
@@ -2335,7 +2373,7 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
|
|
|
2335
2373
|
const plugins = [
|
|
2336
2374
|
...rewritePlugins,
|
|
2337
2375
|
{
|
|
2338
|
-
name: `${
|
|
2376
|
+
name: `${_chunkHVNGIKLSjs.vitePluginName}:post`,
|
|
2339
2377
|
enforce: "post",
|
|
2340
2378
|
async configResolved(config) {
|
|
2341
2379
|
resolvedConfig = config;
|