weapp-tailwindcss 4.12.0-alpha.1 → 4.12.0-alpha.3
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-CAZQZPMY.js → chunk-2PFYPSPO.js} +36 -36
- package/dist/{chunk-F2CKKG6Q.mjs → chunk-3VQKDHGP.mjs} +12 -4
- package/dist/{chunk-5CF3HTTN.mjs → chunk-6MIA3KYY.mjs} +2 -2
- package/dist/{chunk-C2E5ZLNI.mjs → chunk-6VMGUTN6.mjs} +3 -3
- package/dist/{chunk-OYSABARD.js → chunk-E7I5TW5K.js} +3 -2
- package/dist/{chunk-V34LWQTS.mjs → chunk-I5H5RDWS.mjs} +40 -17
- package/dist/{chunk-ZABCOAAS.mjs → chunk-J6FIO3RO.mjs} +48 -34
- package/dist/{chunk-GMKSBLNY.js → chunk-L3O54VR6.js} +13 -5
- package/dist/{chunk-RQWWSU4U.js → chunk-OSWTWMAK.js} +23 -9
- package/dist/{chunk-IUYO6NQO.js → chunk-P2X2S444.js} +7 -7
- package/dist/{chunk-4LBAL3RE.js → chunk-SON7XE3T.js} +73 -50
- package/dist/{chunk-CTGWJGKJ.js → chunk-UVMAPQU7.js} +5 -5
- package/dist/{chunk-JRLWGMVZ.mjs → chunk-XHTCHZVE.mjs} +1 -1
- package/dist/{chunk-2LH6PZH3.mjs → chunk-ZCH4YINE.mjs} +3 -2
- package/dist/cli.js +2236 -164
- package/dist/cli.mjs +2241 -169
- package/dist/core.js +7 -7
- package/dist/core.mjs +1 -1
- package/dist/css-macro/postcss.js +3 -3
- package/dist/css-macro/postcss.mjs +1 -1
- package/dist/css-macro.js +4 -4
- package/dist/css-macro.mjs +1 -1
- package/dist/gulp.js +3 -3
- package/dist/gulp.mjs +2 -2
- package/dist/index.js +7 -7
- package/dist/index.mjs +6 -6
- package/dist/vite.js +4 -4
- package/dist/vite.mjs +3 -3
- 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 +5 -5
- package/dist/webpack.mjs +4 -4
- package/dist/webpack4.js +56 -52
- package/dist/webpack4.mjs +26 -22
- package/package.json +7 -6
- package/scripts/postinstall.mjs +59 -0
|
@@ -6,7 +6,8 @@
|
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
|
|
10
|
+
var _chunkL3O54VR6js = require('./chunk-L3O54VR6.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 _chunkOSWTWMAKjs = require('./chunk-OSWTWMAK.js');
|
|
31
32
|
|
|
32
33
|
|
|
33
34
|
|
|
@@ -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(_chunkOSWTWMAKjs.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(_chunkOSWTWMAKjs.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 = _chunkOSWTWMAKjs.babelParse.call(void 0, wrapped, {
|
|
139
140
|
plugins: ["typescript"],
|
|
140
141
|
sourceType: options.wrapExpression ? "module" : "unambiguous"
|
|
141
142
|
});
|
|
142
|
-
const analysis =
|
|
143
|
+
const analysis = _chunkOSWTWMAKjs.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 || _chunkOSWTWMAKjs.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 = _chunkOSWTWMAKjs.babelParse.call(void 0, wrapped, {
|
|
166
167
|
plugins: ["typescript"],
|
|
167
168
|
sourceType: options.wrapExpression ? "module" : "unambiguous"
|
|
168
169
|
});
|
|
169
|
-
const analysis =
|
|
170
|
+
const analysis = _chunkOSWTWMAKjs.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, _chunkOSWTWMAKjs.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, _chunkOSWTWMAKjs.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])) {
|
|
@@ -273,7 +274,7 @@ function updateDirectiveExpression(ms, prop, jsHandler, runtimeSet, expression =
|
|
|
273
274
|
if (start >= end) {
|
|
274
275
|
return;
|
|
275
276
|
}
|
|
276
|
-
const generated =
|
|
277
|
+
const generated = _chunkOSWTWMAKjs.generateCode.call(void 0, expression, {
|
|
277
278
|
jsHandler,
|
|
278
279
|
runtimeSet,
|
|
279
280
|
wrapExpression: true
|
|
@@ -292,7 +293,7 @@ function updateDirectiveExpressionWithLocalStyle(ms, prop, jsHandler, collector,
|
|
|
292
293
|
collector.collectRuntimeClasses(expression, {
|
|
293
294
|
wrapExpression: true
|
|
294
295
|
});
|
|
295
|
-
const generated =
|
|
296
|
+
const generated = _chunkOSWTWMAKjs.generateCode.call(void 0, expression, {
|
|
296
297
|
jsHandler,
|
|
297
298
|
runtimeSet,
|
|
298
299
|
wrapExpression: true
|
|
@@ -322,7 +323,7 @@ function transformUVue(code, id, jsHandler, runtimeSet, options = {}) {
|
|
|
322
323
|
return;
|
|
323
324
|
}
|
|
324
325
|
const { customAttributesEntities, disabledDefaultTemplateHandler = false } = options;
|
|
325
|
-
const matchCustomAttribute =
|
|
326
|
+
const matchCustomAttribute = _chunkOSWTWMAKjs.createAttributeMatcher.call(void 0, customAttributesEntities);
|
|
326
327
|
const ms = new (0, _magicstring2.default)(code);
|
|
327
328
|
const { descriptor, errors } = _compilersfc.parse.call(void 0, code);
|
|
328
329
|
const localStyleCollector = options.enableComponentLocalStyle && shouldEnableComponentLocalStyle(id) ? new UniAppXComponentLocalStyleCollector(id, runtimeSet) : void 0;
|
|
@@ -401,13 +402,17 @@ function transformUVue(code, id, jsHandler, runtimeSet, options = {}) {
|
|
|
401
402
|
${localStyleCollector.toStyleBlock()}`);
|
|
402
403
|
}
|
|
403
404
|
}
|
|
404
|
-
|
|
405
|
-
code: ms.toString()
|
|
406
|
-
|
|
407
|
-
|
|
405
|
+
const result = {
|
|
406
|
+
code: ms.toString()
|
|
407
|
+
};
|
|
408
|
+
Object.defineProperty(result, "map", {
|
|
409
|
+
configurable: true,
|
|
410
|
+
enumerable: true,
|
|
411
|
+
get() {
|
|
408
412
|
return ms.generateMap();
|
|
409
413
|
}
|
|
410
|
-
};
|
|
414
|
+
});
|
|
415
|
+
return result;
|
|
411
416
|
}
|
|
412
417
|
|
|
413
418
|
// src/bundlers/vite/query.ts
|
|
@@ -688,7 +693,7 @@ function createUniAppXAssetTask(file, originalSource, outDir, options) {
|
|
|
688
693
|
runtimeSet,
|
|
689
694
|
applyLinkedResults: applyLinkedResults2
|
|
690
695
|
} = options;
|
|
691
|
-
const absoluteFile =
|
|
696
|
+
const absoluteFile = _chunkL3O54VR6js.toAbsoluteOutputPath.call(void 0, file, outDir);
|
|
692
697
|
const rawSource = originalSource.source.toString();
|
|
693
698
|
const rawHashSource = options.hashSalt ? `${rawSource}
|
|
694
699
|
/*${options.hashSalt}*/` : rawSource;
|
|
@@ -760,19 +765,24 @@ function isJavaScriptEntry(entry) {
|
|
|
760
765
|
return entry.fileName.endsWith(".js");
|
|
761
766
|
}
|
|
762
767
|
function createBundleModuleGraphOptions(outputDir, entries) {
|
|
768
|
+
const normalizedEntries = /* @__PURE__ */ new Map();
|
|
769
|
+
for (const [id, entry] of entries) {
|
|
770
|
+
normalizedEntries.set(_chunkL3O54VR6js.normalizeOutputPathKey.call(void 0, id), entry);
|
|
771
|
+
}
|
|
772
|
+
const getEntry = (id) => _nullishCoalesce(entries.get(id), () => ( normalizedEntries.get(_chunkL3O54VR6js.normalizeOutputPathKey.call(void 0, id))));
|
|
763
773
|
return {
|
|
764
774
|
resolve(specifier, importer) {
|
|
765
|
-
return
|
|
775
|
+
return _chunkL3O54VR6js.resolveOutputSpecifier.call(void 0, specifier, importer, outputDir, (candidate) => Boolean(getEntry(candidate)));
|
|
766
776
|
},
|
|
767
777
|
load(id) {
|
|
768
|
-
const entry =
|
|
778
|
+
const entry = getEntry(id);
|
|
769
779
|
if (!entry) {
|
|
770
780
|
return void 0;
|
|
771
781
|
}
|
|
772
782
|
return readOutputEntry(entry);
|
|
773
783
|
},
|
|
774
784
|
filter(id) {
|
|
775
|
-
return
|
|
785
|
+
return Boolean(getEntry(id));
|
|
776
786
|
}
|
|
777
787
|
};
|
|
778
788
|
}
|
|
@@ -780,8 +790,12 @@ function applyLinkedResults(linked, entries, onLinkedUpdate, onApplied) {
|
|
|
780
790
|
if (!linked) {
|
|
781
791
|
return;
|
|
782
792
|
}
|
|
793
|
+
const normalizedEntries = /* @__PURE__ */ new Map();
|
|
794
|
+
for (const [entryId, entry] of entries) {
|
|
795
|
+
normalizedEntries.set(_chunkL3O54VR6js.normalizeOutputPathKey.call(void 0, entryId), entry);
|
|
796
|
+
}
|
|
783
797
|
for (const [id, { code }] of Object.entries(linked)) {
|
|
784
|
-
const entry = entries.get(id);
|
|
798
|
+
const entry = _nullishCoalesce(entries.get(id), () => ( normalizedEntries.get(_chunkL3O54VR6js.normalizeOutputPathKey.call(void 0, id))));
|
|
785
799
|
if (!entry) {
|
|
786
800
|
continue;
|
|
787
801
|
}
|
|
@@ -836,14 +850,14 @@ function createHtmlRuntimeAffectingSignature(source) {
|
|
|
836
850
|
}
|
|
837
851
|
function createJsRuntimeAffectingSignature(source) {
|
|
838
852
|
try {
|
|
839
|
-
const ast =
|
|
853
|
+
const ast = _chunkOSWTWMAKjs.babelParse.call(void 0, source, {
|
|
840
854
|
cache: true,
|
|
841
855
|
cacheKey: "vite-runtime-affecting:unambiguous",
|
|
842
856
|
plugins: ["jsx", "typescript"],
|
|
843
857
|
sourceType: "unambiguous"
|
|
844
858
|
});
|
|
845
859
|
const parts = [];
|
|
846
|
-
|
|
860
|
+
_chunkOSWTWMAKjs.traverse.call(void 0, ast, {
|
|
847
861
|
noScope: true,
|
|
848
862
|
StringLiteral(path7) {
|
|
849
863
|
parts.push(`s:${path7.node.value}`);
|
|
@@ -935,7 +949,7 @@ function collectJsEntries(fileName, output, outDir, store) {
|
|
|
935
949
|
if (!isJavaScriptEntry(entry)) {
|
|
936
950
|
return;
|
|
937
951
|
}
|
|
938
|
-
const absolute =
|
|
952
|
+
const absolute = _chunkL3O54VR6js.toAbsoluteOutputPath.call(void 0, fileName, outDir);
|
|
939
953
|
store.set(absolute, entry);
|
|
940
954
|
}
|
|
941
955
|
function markProcessFile(type, file, processFiles) {
|
|
@@ -1261,6 +1275,11 @@ function createGenerateBundleHook(context) {
|
|
|
1261
1275
|
);
|
|
1262
1276
|
}
|
|
1263
1277
|
const jsEntries = snapshot.jsEntries;
|
|
1278
|
+
const normalizedJsEntries = /* @__PURE__ */ new Map();
|
|
1279
|
+
for (const [id, entry] of jsEntries) {
|
|
1280
|
+
normalizedJsEntries.set(_chunkL3O54VR6js.normalizeOutputPathKey.call(void 0, id), entry);
|
|
1281
|
+
}
|
|
1282
|
+
const getJsEntry = (id) => _nullishCoalesce(jsEntries.get(id), () => ( normalizedJsEntries.get(_chunkL3O54VR6js.normalizeOutputPathKey.call(void 0, id))));
|
|
1264
1283
|
const moduleGraphOptions = createBundleModuleGraphOptions(outDir, jsEntries);
|
|
1265
1284
|
const runtimeStart = performance.now();
|
|
1266
1285
|
const runtime = useBundleRuntimeClassSet ? await ensureBundleRuntimeClassSet(snapshot, forceRuntimeRefreshByEnv) : await context.ensureRuntimeClassSet(forceRuntimeRefreshByEnv);
|
|
@@ -1464,7 +1483,7 @@ function createGenerateBundleHook(context) {
|
|
|
1464
1483
|
debug3("js cache replay miss, fallback transform: %s", file);
|
|
1465
1484
|
}
|
|
1466
1485
|
const handlerOptions = createHandlerOptions(absoluteFile);
|
|
1467
|
-
if (!disableJsPrecheck &&
|
|
1486
|
+
if (!disableJsPrecheck && _chunkOSWTWMAKjs.shouldSkipJsTransform.call(void 0, rawSource, handlerOptions)) {
|
|
1468
1487
|
metrics.js.elapsed += measureElapsed(start);
|
|
1469
1488
|
metrics.js.transformed++;
|
|
1470
1489
|
return {
|
|
@@ -1478,7 +1497,7 @@ function createGenerateBundleHook(context) {
|
|
|
1478
1497
|
debug3("js handle: %s", file);
|
|
1479
1498
|
if (linked) {
|
|
1480
1499
|
for (const id of Object.keys(linked)) {
|
|
1481
|
-
const linkedEntry =
|
|
1500
|
+
const linkedEntry = getJsEntry(id);
|
|
1482
1501
|
if (linkedEntry && linkedSet) {
|
|
1483
1502
|
linkedSet.add(linkedEntry.fileName);
|
|
1484
1503
|
}
|
|
@@ -1500,7 +1519,7 @@ function createGenerateBundleHook(context) {
|
|
|
1500
1519
|
const wrappedApplyLinkedUpdates = (linked) => {
|
|
1501
1520
|
if (linked) {
|
|
1502
1521
|
for (const id of Object.keys(linked)) {
|
|
1503
|
-
const linkedEntry =
|
|
1522
|
+
const linkedEntry = getJsEntry(id);
|
|
1504
1523
|
if (linkedEntry && linkedSet) {
|
|
1505
1524
|
linkedSet.add(linkedEntry.fileName);
|
|
1506
1525
|
}
|
|
@@ -1550,7 +1569,7 @@ function createGenerateBundleHook(context) {
|
|
|
1550
1569
|
sourceType: "unambiguous"
|
|
1551
1570
|
}
|
|
1552
1571
|
});
|
|
1553
|
-
if (!disableJsPrecheck &&
|
|
1572
|
+
if (!disableJsPrecheck && _chunkOSWTWMAKjs.shouldSkipJsTransform.call(void 0, currentSource, precheckOptions)) {
|
|
1554
1573
|
metrics.js.elapsed += measureElapsed(start);
|
|
1555
1574
|
metrics.js.transformed++;
|
|
1556
1575
|
return;
|
|
@@ -1561,7 +1580,7 @@ function createGenerateBundleHook(context) {
|
|
|
1561
1580
|
});
|
|
1562
1581
|
}
|
|
1563
1582
|
}
|
|
1564
|
-
|
|
1583
|
+
_chunkL3O54VR6js.pushConcurrentTaskFactories.call(void 0, tasks, jsTaskFactories);
|
|
1565
1584
|
await Promise.all(tasks);
|
|
1566
1585
|
for (const apply of pendingLinkedUpdates) {
|
|
1567
1586
|
apply();
|
|
@@ -1603,7 +1622,7 @@ var _module = require('module');
|
|
|
1603
1622
|
|
|
1604
1623
|
|
|
1605
1624
|
var _tailwindcsspatch = require('tailwindcss-patch');
|
|
1606
|
-
var debug =
|
|
1625
|
+
var debug = _chunkOSWTWMAKjs.createDebug.call(void 0, "[vite:runtime-set] ");
|
|
1607
1626
|
var require2 = _module.createRequire.call(void 0, _chunkONLKZIRQjs.importMetaUrl);
|
|
1608
1627
|
var EXTENSION_DOT_PREFIX_RE = /^\./;
|
|
1609
1628
|
var VALIDATION_FILE_NAME = "runtime-candidates.html";
|
|
@@ -2071,12 +2090,12 @@ function createRewriteCssImportsPlugins(options) {
|
|
|
2071
2090
|
const resolveAppType = () => _nullishCoalesce(_optionalChain([getAppType, 'optionalCall', _68 => _68()]), () => ( appType));
|
|
2072
2091
|
return [
|
|
2073
2092
|
{
|
|
2074
|
-
name: `${
|
|
2093
|
+
name: `${_chunkOSWTWMAKjs.vitePluginName}:rewrite-css-imports`,
|
|
2075
2094
|
enforce: "pre",
|
|
2076
2095
|
resolveId: {
|
|
2077
2096
|
order: "pre",
|
|
2078
2097
|
handler(id, importer) {
|
|
2079
|
-
const replacement =
|
|
2098
|
+
const replacement = _chunkL3O54VR6js.resolveTailwindcssImport.call(void 0, id, weappTailwindcssDirPosix2, {
|
|
2080
2099
|
join: joinPosixPath,
|
|
2081
2100
|
appType: resolveAppType()
|
|
2082
2101
|
});
|
|
@@ -2095,7 +2114,7 @@ function createRewriteCssImportsPlugins(options) {
|
|
|
2095
2114
|
if (!isCSSRequest(id)) {
|
|
2096
2115
|
return null;
|
|
2097
2116
|
}
|
|
2098
|
-
const rewritten =
|
|
2117
|
+
const rewritten = _chunkL3O54VR6js.rewriteTailwindcssImportsInCode.call(void 0, code, weappTailwindcssDirPosix2, {
|
|
2099
2118
|
join: joinPosixPath,
|
|
2100
2119
|
appType: resolveAppType()
|
|
2101
2120
|
});
|
|
@@ -2113,10 +2132,17 @@ function createRewriteCssImportsPlugins(options) {
|
|
|
2113
2132
|
}
|
|
2114
2133
|
|
|
2115
2134
|
// src/bundlers/vite/index.ts
|
|
2116
|
-
var debug2 =
|
|
2117
|
-
var weappTailwindcssPackageDir =
|
|
2135
|
+
var debug2 = _chunkOSWTWMAKjs.createDebug.call(void 0, );
|
|
2136
|
+
var weappTailwindcssPackageDir = _chunkL3O54VR6js.resolvePackageDir.call(void 0, "weapp-tailwindcss");
|
|
2118
2137
|
var weappTailwindcssDirPosix = slash(weappTailwindcssPackageDir);
|
|
2119
2138
|
var PACKAGE_JSON_FILE2 = "package.json";
|
|
2139
|
+
function getPostcssPluginName(plugin) {
|
|
2140
|
+
if (!plugin || typeof plugin !== "object" || !("postcssPlugin" in plugin)) {
|
|
2141
|
+
return;
|
|
2142
|
+
}
|
|
2143
|
+
const { postcssPlugin } = plugin;
|
|
2144
|
+
return typeof postcssPlugin === "string" ? postcssPlugin : void 0;
|
|
2145
|
+
}
|
|
2120
2146
|
function resolveImplicitTailwindcssBasedirFromViteRoot(root) {
|
|
2121
2147
|
const resolvedRoot = _path2.default.resolve(root);
|
|
2122
2148
|
if (!_fs.existsSync.call(void 0, resolvedRoot)) {
|
|
@@ -2146,7 +2172,7 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
|
|
|
2146
2172
|
const hasExplicitAppType = typeof options.appType === "string" && options.appType.trim().length > 0;
|
|
2147
2173
|
const rewriteCssImportsSpecified = Object.hasOwn(options, "rewriteCssImports");
|
|
2148
2174
|
const hasExplicitTailwindcssBasedir = typeof options.tailwindcssBasedir === "string" && options.tailwindcssBasedir.trim().length > 0;
|
|
2149
|
-
const opts =
|
|
2175
|
+
const opts = _chunkOSWTWMAKjs.getCompilerContext.call(void 0, options);
|
|
2150
2176
|
const {
|
|
2151
2177
|
disabled,
|
|
2152
2178
|
customAttributes,
|
|
@@ -2160,7 +2186,7 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
|
|
|
2160
2186
|
disabledDefaultTemplateHandler
|
|
2161
2187
|
} = opts;
|
|
2162
2188
|
const uniAppXEnabled = _chunkNIS74SI6js.isUniAppXEnabled.call(void 0, uniAppX);
|
|
2163
|
-
const disabledOptions =
|
|
2189
|
+
const disabledOptions = _chunkL3O54VR6js.resolveDisabledOptions.call(void 0, disabled);
|
|
2164
2190
|
const tailwindcssMajorVersion = _nullishCoalesce(initialTwPatcher.majorVersion, () => ( 0));
|
|
2165
2191
|
const shouldRewriteCssImports = opts.rewriteCssImports !== false && !disabledOptions.rewriteCssImports && (rewriteCssImportsSpecified || tailwindcssMajorVersion >= 4);
|
|
2166
2192
|
const rewritePlugins = createRewriteCssImportsPlugins({
|
|
@@ -2171,8 +2197,8 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
|
|
|
2171
2197
|
if (disabledOptions.plugin) {
|
|
2172
2198
|
return rewritePlugins.length ? rewritePlugins : void 0;
|
|
2173
2199
|
}
|
|
2174
|
-
const customAttributesEntities =
|
|
2175
|
-
const patchRecorderState =
|
|
2200
|
+
const customAttributesEntities = _chunkOSWTWMAKjs.toCustomAttributesEntities.call(void 0, customAttributes);
|
|
2201
|
+
const patchRecorderState = _chunkOSWTWMAKjs.setupPatchRecorder.call(void 0, initialTwPatcher, opts.tailwindcssBasedir, {
|
|
2176
2202
|
source: "runtime",
|
|
2177
2203
|
cwd: _nullishCoalesce(opts.tailwindcssBasedir, () => ( _process2.default.cwd()))
|
|
2178
2204
|
});
|
|
@@ -2211,7 +2237,7 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
|
|
|
2211
2237
|
async function refreshRuntimeState(force) {
|
|
2212
2238
|
const invalidation = resolveRuntimeRefreshOptions();
|
|
2213
2239
|
const shouldRefresh = force || invalidation.changed;
|
|
2214
|
-
const refreshed = await
|
|
2240
|
+
const refreshed = await _chunkOSWTWMAKjs.refreshTailwindRuntimeState.call(void 0, runtimeState, {
|
|
2215
2241
|
force: shouldRefresh,
|
|
2216
2242
|
clearCache: force || invalidation.changed
|
|
2217
2243
|
});
|
|
@@ -2232,7 +2258,7 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
|
|
|
2232
2258
|
}
|
|
2233
2259
|
if (forceRuntimeRefresh || !runtimeSetPromise) {
|
|
2234
2260
|
const invalidation = resolveRuntimeRefreshOptions();
|
|
2235
|
-
const task2 =
|
|
2261
|
+
const task2 = _chunkOSWTWMAKjs.collectRuntimeClassSet.call(void 0, runtimeState.twPatcher, {
|
|
2236
2262
|
force: forceRuntimeRefresh || invalidation.changed,
|
|
2237
2263
|
skipRefresh: forceRuntimeRefresh,
|
|
2238
2264
|
clearCache: forceRuntimeRefresh || invalidation.changed
|
|
@@ -2274,7 +2300,7 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
|
|
|
2274
2300
|
if (!forceRuntimeRefresh && !invalidation.changed && !forceCollectBySource && runtimeSet) {
|
|
2275
2301
|
return runtimeSet;
|
|
2276
2302
|
}
|
|
2277
|
-
const task =
|
|
2303
|
+
const task = _chunkOSWTWMAKjs.collectRuntimeClassSet.call(void 0, runtimeState.twPatcher, {
|
|
2278
2304
|
force: forceRuntimeRefresh || invalidation.changed || forceCollectBySource,
|
|
2279
2305
|
skipRefresh: forceRuntimeRefresh,
|
|
2280
2306
|
clearCache: forceRuntimeRefresh || invalidation.changed
|
|
@@ -2309,7 +2335,7 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
|
|
|
2309
2335
|
const plugins = [
|
|
2310
2336
|
...rewritePlugins,
|
|
2311
2337
|
{
|
|
2312
|
-
name: `${
|
|
2338
|
+
name: `${_chunkOSWTWMAKjs.vitePluginName}:post`,
|
|
2313
2339
|
enforce: "post",
|
|
2314
2340
|
async configResolved(config) {
|
|
2315
2341
|
resolvedConfig = config;
|
|
@@ -2347,10 +2373,7 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
|
|
|
2347
2373
|
}
|
|
2348
2374
|
if (typeof config.css.postcss === "object" && Array.isArray(config.css.postcss.plugins)) {
|
|
2349
2375
|
const postcssPlugins = config.css.postcss.plugins;
|
|
2350
|
-
const idx = postcssPlugins.findIndex((x) => (
|
|
2351
|
-
// @ts-ignore
|
|
2352
|
-
x.postcssPlugin === "postcss-html-transform"
|
|
2353
|
-
));
|
|
2376
|
+
const idx = postcssPlugins.findIndex((x) => getPostcssPluginName(x) === "postcss-html-transform");
|
|
2354
2377
|
if (idx > -1) {
|
|
2355
2378
|
postcssPlugins.splice(idx, 1, _htmltransform2.default.call(void 0, ));
|
|
2356
2379
|
debug2("remove postcss-html-transform plugin from vite config");
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkL3O54VR6js = require('./chunk-L3O54VR6.js');
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
var
|
|
6
|
+
var _chunkOSWTWMAKjs = require('./chunk-OSWTWMAK.js');
|
|
7
7
|
|
|
8
8
|
// src/shared/mpx.ts
|
|
9
9
|
var _path = require('path'); var _path2 = _interopRequireDefault(_path);
|
|
@@ -145,7 +145,7 @@ function rewriteTailwindcssRequestForCss(data, pkgDir, appType) {
|
|
|
145
145
|
if (!CSS_EXT_RE2.test(normalizedIssuer)) {
|
|
146
146
|
return;
|
|
147
147
|
}
|
|
148
|
-
const resolved =
|
|
148
|
+
const resolved = _chunkL3O54VR6js.resolveTailwindcssImport.call(void 0, request, pkgDir, { appType });
|
|
149
149
|
if (!resolved) {
|
|
150
150
|
return;
|
|
151
151
|
}
|
|
@@ -155,8 +155,8 @@ function applyTailwindcssCssImportRewrite(compiler, options) {
|
|
|
155
155
|
if (!options.enabled) {
|
|
156
156
|
return;
|
|
157
157
|
}
|
|
158
|
-
compiler.hooks.normalModuleFactory.tap(
|
|
159
|
-
factory.hooks.beforeResolve.tap(
|
|
158
|
+
compiler.hooks.normalModuleFactory.tap(_chunkOSWTWMAKjs.pluginName, (factory) => {
|
|
159
|
+
factory.hooks.beforeResolve.tap(_chunkOSWTWMAKjs.pluginName, (data) => {
|
|
160
160
|
rewriteTailwindcssRequestForCss(data, options.pkgDir, options.appType);
|
|
161
161
|
});
|
|
162
162
|
});
|
|
@@ -33,12 +33,13 @@ function ifndef(text) {
|
|
|
33
33
|
}
|
|
34
34
|
var QUERY_KEY_REGEX = new RegExp(`\\(\\s*${queryKey}\\s*:\\s*"([^)]*)"\\)`, "g");
|
|
35
35
|
function matchCustomPropertyFromValue(str, cb) {
|
|
36
|
-
let arr;
|
|
37
36
|
let index = 0;
|
|
38
37
|
QUERY_KEY_REGEX.lastIndex = 0;
|
|
39
|
-
|
|
38
|
+
let arr = QUERY_KEY_REGEX.exec(str);
|
|
39
|
+
while (arr !== null) {
|
|
40
40
|
cb(arr, index);
|
|
41
41
|
index++;
|
|
42
|
+
arr = QUERY_KEY_REGEX.exec(str);
|
|
42
43
|
}
|
|
43
44
|
}
|
|
44
45
|
|