weapp-tailwindcss 5.0.0-next.2 → 5.0.0-next.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -5
- package/bin/weapp-tailwindcss.js +1 -21
- package/dist/bundlers/shared/generator-css.d.ts +5 -2
- package/dist/bundlers/vite/generate-bundle.d.ts +1 -0
- package/dist/bundlers/vite/index.d.ts +1 -1
- package/dist/bundlers/vite/rewrite-css-imports.d.ts +1 -0
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-loaders.d.ts +0 -1
- package/dist/bundlers/webpack/loaders/weapp-tw-css-import-rewrite-loader.d.ts +1 -1
- package/dist/cli/context.d.ts +0 -3
- package/dist/cli/mount-options.d.ts +2 -0
- package/dist/cli.js +8 -2
- package/dist/cli.mjs +8 -2
- package/dist/constants.d.ts +1 -1
- package/dist/core.js +1 -1
- package/dist/core.mjs +1 -1
- package/dist/css-macro.d.ts +1 -0
- package/dist/defaults.js +5 -7
- package/dist/defaults.mjs +5 -7
- package/dist/generator/index.d.ts +1 -1
- package/dist/generator/options.d.ts +3 -4
- package/dist/{generator-mmhXzZnv.js → generator-9UEp8OoQ.js} +259 -21
- package/dist/{generator-Y-Ikv4Fu.mjs → generator-Dpp-5s8z.mjs} +260 -22
- package/dist/{generator-css-D3OdPRiS.js → generator-css-CGueCYbX.js} +182 -42
- package/dist/{generator-css-B5ejWUMv.mjs → generator-css-MyjZhF0z.mjs} +182 -42
- package/dist/generator.js +1 -1
- package/dist/generator.mjs +1 -1
- package/dist/gulp.js +17 -14
- package/dist/gulp.mjs +17 -14
- package/dist/index.d.ts +1 -1
- package/dist/index.js +4 -4
- package/dist/index.mjs +4 -4
- package/dist/js/index.d.ts +1 -0
- package/dist/js/literal-transform.d.ts +2 -0
- package/dist/{logger-BoVx1Dbt.mjs → logger-1gx9UllH.mjs} +21 -51
- package/dist/{logger-BZ45DZJT.js → logger-D9clu_3f.js} +21 -51
- package/dist/patcher-options-DnqazL9E.js +34 -0
- package/dist/patcher-options-GuOwX0-k.mjs +17 -0
- package/dist/postcss.d.ts +2 -2
- package/dist/postcss.js +37 -28
- package/dist/postcss.mjs +37 -28
- package/dist/presets.js +1 -1
- package/dist/presets.mjs +1 -1
- package/dist/{recorder-zsgatmkB.mjs → recorder-BIW3Kuke.mjs} +5 -12
- package/dist/{recorder-gYSNLfOP.js → recorder-D4BKt75Q.js} +5 -12
- package/dist/reset.d.ts +1 -0
- package/dist/{css-imports-BbrbluP9.js → run-tasks-Cq5A5nVD.js} +6 -55
- package/dist/{css-imports-CSdPq_Sc.mjs → run-tasks-DUVrDJGl.mjs} +5 -42
- package/dist/tailwindcss/miniprogram.d.ts +5 -1
- package/dist/tailwindcss/patcher-options.d.ts +3 -51
- package/dist/tailwindcss/patcher.d.ts +1 -2
- package/dist/tailwindcss/v4/patcher-options.d.ts +1 -23
- package/dist/tailwindcss/v4/patcher.d.ts +1 -0
- package/dist/tailwindcss/v4-engine/types.d.ts +1 -1
- package/dist/tailwindcss/version.d.ts +4 -0
- package/dist/typedoc.export.d.ts +0 -2
- package/dist/types/index.d.ts +1 -3
- package/dist/types/shared.d.ts +3 -0
- package/dist/types/user-defined-options/general.d.ts +0 -2
- package/dist/types/user-defined-options/important.d.ts +3 -3
- package/dist/utils/disabled.d.ts +2 -3
- package/dist/version-CWBxRFPB.js +56 -0
- package/dist/version-WNz3MwRv.mjs +49 -0
- package/dist/{vite-BC9U7ahn.js → vite-BkMGwDeH.js} +106 -39
- package/dist/{vite-CrlzCNqz.mjs → vite-fDM-UQpR.mjs} +89 -22
- package/dist/vite.d.ts +1 -2
- package/dist/vite.js +3 -4
- package/dist/vite.mjs +2 -2
- package/dist/weapp-tw-css-import-rewrite-loader.js +1 -1
- package/dist/{webpack-DD7A6V0u.js → webpack-CICGEKT9.js} +225 -43
- package/dist/{webpack-Bu6M-Hbw.mjs → webpack-D2Wdk28V.mjs} +214 -27
- package/dist/webpack.js +1 -1
- package/dist/webpack.mjs +1 -1
- package/package.json +21 -30
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v4-assets.d.ts +0 -14
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v4-loaders.d.ts +0 -15
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v4.d.ts +0 -9
- package/dist/experimental/index.d.ts +0 -2
- package/dist/experimental/oxc/ast-utils.d.ts +0 -30
- package/dist/experimental/oxc/index.d.ts +0 -2
- package/dist/experimental/oxc/module-specifiers.d.ts +0 -2
- package/dist/experimental/shared/cache.d.ts +0 -3
- package/dist/experimental/shared/transform.d.ts +0 -3
- package/dist/experimental/shared.d.ts +0 -8
- package/dist/experimental/swc/ast-utils.d.ts +0 -30
- package/dist/experimental/swc/index.d.ts +0 -2
- package/dist/experimental/swc/module-specifiers.d.ts +0 -2
- package/dist/loader-anchors-CNkWT8hx.js +0 -273
- package/dist/loader-anchors-TrU7EUr7.mjs +0 -205
- package/dist/patcher-options-6gJN2EXy.js +0 -115
- package/dist/patcher-options-DQfR5xxT.mjs +0 -92
- package/dist/types/disabled-options.d.ts +0 -4
- package/dist/webpack4.d.ts +0 -4
- package/dist/webpack4.js +0 -387
- package/dist/webpack4.mjs +0 -379
- package/scripts/postinstall.mjs +0 -59
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { d as filterUnsupportedMiniProgramTailwindV4Candidates, f as loadTailwindV4DesignSystem, i as normalizeWeappTailwindcssGeneratorOptions, s as resolveTailwindV4SourceFromPatcher } from "./generator-
|
|
2
|
-
import { r as resolveTailwindcssOptions } from "./patcher-options-
|
|
3
|
-
import { _ as refreshTailwindRuntimeState, a as createAttributeMatcher, c as isClassContextLiteralPath, d as traverse$1, f as toCustomAttributesEntities, h as collectRuntimeClassSet, i as generateCode, l as replaceWxml, m as vitePluginName, n as shouldSkipJsTransform, o as analyzeSource, r as getCompilerContext, s as JsTokenUpdater, t as setupPatchRecorder, u as babelParse, v as createDebug } from "./recorder-
|
|
1
|
+
import { d as filterUnsupportedMiniProgramTailwindV4Candidates, f as loadTailwindV4DesignSystem, i as normalizeWeappTailwindcssGeneratorOptions, s as resolveTailwindV4SourceFromPatcher } from "./generator-Dpp-5s8z.mjs";
|
|
2
|
+
import { r as resolveTailwindcssOptions } from "./patcher-options-GuOwX0-k.mjs";
|
|
3
|
+
import { _ as refreshTailwindRuntimeState, a as createAttributeMatcher, c as isClassContextLiteralPath, d as traverse$1, f as toCustomAttributesEntities, h as collectRuntimeClassSet, i as generateCode, l as replaceWxml, m as vitePluginName, n as shouldSkipJsTransform, o as analyzeSource, r as getCompilerContext, s as JsTokenUpdater, t as setupPatchRecorder, u as babelParse, v as createDebug } from "./recorder-BIW3Kuke.mjs";
|
|
4
4
|
import { o as resolveUniUtsPlatform } from "./utils-7DUGTFED.mjs";
|
|
5
|
-
import { a as resolveUniAppXOptions, d as getRuntimeClassSetSignature, i as isUniAppXEnabled, l as findNearestPackageRoot, o as findTailwindConfig, t as logger$1 } from "./logger-
|
|
6
|
-
import { i as processCachedTask, n as hasTailwindGeneratedCssMarkers, r as hasTailwindSourceDirectives, t as generateCssByGenerator } from "./generator-css-
|
|
7
|
-
import { a as
|
|
5
|
+
import { a as resolveUniAppXOptions, d as getRuntimeClassSetSignature, i as isUniAppXEnabled, l as findNearestPackageRoot, o as findTailwindConfig, t as logger$1 } from "./logger-1gx9UllH.mjs";
|
|
6
|
+
import { i as processCachedTask, n as hasTailwindGeneratedCssMarkers, r as hasTailwindSourceDirectives, t as generateCssByGenerator } from "./generator-css-MyjZhF0z.mjs";
|
|
7
|
+
import { a as resolveOutputSpecifier, i as normalizeOutputPathKey, n as resolvePackageDir, o as toAbsoluteOutputPath, r as resolvePluginDisabledState, t as pushConcurrentTaskFactories } from "./run-tasks-DUVrDJGl.mjs";
|
|
8
8
|
import path from "node:path";
|
|
9
9
|
import process from "node:process";
|
|
10
10
|
import { extractRawCandidatesWithPositions, extractValidCandidates } from "tailwindcss-patch";
|
|
@@ -504,6 +504,22 @@ function createUniAppXAssetTask(file, originalSource, outDir, options) {
|
|
|
504
504
|
}
|
|
505
505
|
//#endregion
|
|
506
506
|
//#region src/bundlers/vite/css-finalizer.ts
|
|
507
|
+
function isAddWatchFileInvalidRollupPhaseError$1(error) {
|
|
508
|
+
const candidate = error;
|
|
509
|
+
return candidate?.code === "INVALID_ROLLUP_PHASE" || candidate?.pluginCode === "INVALID_ROLLUP_PHASE" || candidate?.message?.includes("Cannot call \"addWatchFile\" after the build has finished.") === true;
|
|
510
|
+
}
|
|
511
|
+
function registerGeneratorDependencies$1(ctx, dependencies) {
|
|
512
|
+
if (typeof ctx.addWatchFile !== "function") return;
|
|
513
|
+
for (const dependency of dependencies ?? []) try {
|
|
514
|
+
ctx.addWatchFile(dependency);
|
|
515
|
+
} catch (error) {
|
|
516
|
+
if (isAddWatchFileInvalidRollupPhaseError$1(error)) {
|
|
517
|
+
logger.debug("跳过生成模式依赖监听注册,当前 Rollup 阶段不允许 addWatchFile: %s", dependency);
|
|
518
|
+
continue;
|
|
519
|
+
}
|
|
520
|
+
throw error;
|
|
521
|
+
}
|
|
522
|
+
}
|
|
507
523
|
function createCssHandlerOptions(opts, majorVersion, file) {
|
|
508
524
|
return {
|
|
509
525
|
isMainChunk: opts.mainCssChunkMatcher(file, opts.appType),
|
|
@@ -516,7 +532,7 @@ function shouldGenerateCssByGenerator(opts, file, rawSource, processed) {
|
|
|
516
532
|
return processed && shouldFinalizeProcessedCssAsset(opts, file);
|
|
517
533
|
}
|
|
518
534
|
function shouldFinalizeProcessedCssAsset(opts, file) {
|
|
519
|
-
return
|
|
535
|
+
return opts.mainCssChunkMatcher(file, opts.appType);
|
|
520
536
|
}
|
|
521
537
|
function createViteCssFinalizerOutputPlugin(context) {
|
|
522
538
|
return {
|
|
@@ -555,6 +571,7 @@ function createViteCssFinalizerOutputPlugin(context) {
|
|
|
555
571
|
}) : void 0;
|
|
556
572
|
const nextCss = generated?.css ?? (await opts.styleHandler(rawSource, cssHandlerOptions)).css;
|
|
557
573
|
if (generated) {
|
|
574
|
+
registerGeneratorDependencies$1(this, generated.dependencies);
|
|
558
575
|
debug("css finalizer generated result: %s bytes=%d", file, nextCss.length);
|
|
559
576
|
recordCssAssetResult?.(file, nextCss);
|
|
560
577
|
if (cssHandlerOptions.isMainChunk) rememberMainCssSource?.(file, rawSource);
|
|
@@ -921,7 +938,7 @@ function createCssTransformShareScope(file, rawSource) {
|
|
|
921
938
|
return "global";
|
|
922
939
|
}
|
|
923
940
|
function createCssTransformShareScopeKey(opts, file, rawSource) {
|
|
924
|
-
if (
|
|
941
|
+
if (opts.mainCssChunkMatcher(file, opts.appType)) return `main:${normalizeOutputPathKey(file)}`;
|
|
925
942
|
return createCssTransformShareScope(file, rawSource);
|
|
926
943
|
}
|
|
927
944
|
function createCssRuntimeSignature(runtimeSignature, generatorCandidateSignature) {
|
|
@@ -939,6 +956,22 @@ function createReplayCssAsset(fileName, source) {
|
|
|
939
956
|
originalFileNames: []
|
|
940
957
|
};
|
|
941
958
|
}
|
|
959
|
+
function isAddWatchFileInvalidRollupPhaseError(error) {
|
|
960
|
+
const candidate = error;
|
|
961
|
+
return candidate?.code === "INVALID_ROLLUP_PHASE" || candidate?.pluginCode === "INVALID_ROLLUP_PHASE" || candidate?.message?.includes("Cannot call \"addWatchFile\" after the build has finished.") === true;
|
|
962
|
+
}
|
|
963
|
+
function registerGeneratorDependencies(ctx, dependencies) {
|
|
964
|
+
if (typeof ctx.addWatchFile !== "function") return;
|
|
965
|
+
for (const dependency of dependencies ?? []) try {
|
|
966
|
+
ctx.addWatchFile(dependency);
|
|
967
|
+
} catch (error) {
|
|
968
|
+
if (isAddWatchFileInvalidRollupPhaseError(error)) {
|
|
969
|
+
logger.debug("跳过生成模式依赖监听注册,当前 Rollup 阶段不允许 addWatchFile: %s", dependency);
|
|
970
|
+
continue;
|
|
971
|
+
}
|
|
972
|
+
throw error;
|
|
973
|
+
}
|
|
974
|
+
}
|
|
942
975
|
function hasOmittedKnownBundleFiles(currentBundleFiles, previousBundleFiles) {
|
|
943
976
|
const currentFileSet = new Set(currentBundleFiles);
|
|
944
977
|
for (const file of previousBundleFiles) if (!currentFileSet.has(file)) return true;
|
|
@@ -976,6 +1009,7 @@ function createGenerateBundleHook(context) {
|
|
|
976
1009
|
const cssHandlerOptionsCache = /* @__PURE__ */ new Map();
|
|
977
1010
|
const cssUserHandlerOptionsCache = /* @__PURE__ */ new Map();
|
|
978
1011
|
return async function generateBundle(_opt, bundle) {
|
|
1012
|
+
const addWatchFile = (id) => this.addWatchFile?.(id);
|
|
979
1013
|
const { opts, runtimeState, ensureBundleRuntimeClassSet, debug, getResolvedConfig, markCssAssetProcessed, recordCssAssetResult, getSourceCandidates, waitForSourceCandidateSyncs, rememberMainCssSource, getRememberedMainCssSources, getRememberedMainCssSignature, setRememberedMainCssSignature, recordGeneratorCandidates } = context;
|
|
980
1014
|
const { appType, cache, mainCssChunkMatcher, onEnd, onStart, onUpdate, styleHandler, templateHandler, jsHandler, uniAppX } = opts;
|
|
981
1015
|
const generatorOptions = normalizeWeappTailwindcssGeneratorOptions(opts.generator);
|
|
@@ -1035,7 +1069,7 @@ function createGenerateBundleHook(context) {
|
|
|
1035
1069
|
const shouldFilterTailwindV4MiniProgramCandidates = runtimeState.twPatcher.majorVersion === 4 && generatorOptions.target === "weapp";
|
|
1036
1070
|
await waitForSourceCandidateSyncs?.();
|
|
1037
1071
|
const sourceCandidates = getSourceCandidates?.() ?? /* @__PURE__ */ new Set();
|
|
1038
|
-
const collectedGeneratorCandidates =
|
|
1072
|
+
const collectedGeneratorCandidates = new Set(sourceCandidates);
|
|
1039
1073
|
const generatorRuntime = collectLegacyContainerCompatCandidates(sourceCandidates, shouldFilterTailwindV4MiniProgramCandidates ? filterUnsupportedMiniProgramTailwindV4Candidates(collectedGeneratorCandidates) : collectedGeneratorCandidates);
|
|
1040
1074
|
const generatorCandidateSignature = createCandidateSignature(generatorRuntime);
|
|
1041
1075
|
recordGeneratorCandidates?.(generatorRuntime);
|
|
@@ -1157,6 +1191,7 @@ function createGenerateBundleHook(context) {
|
|
|
1157
1191
|
debug
|
|
1158
1192
|
});
|
|
1159
1193
|
if (generated) {
|
|
1194
|
+
registerGeneratorDependencies({ addWatchFile }, generated.dependencies);
|
|
1160
1195
|
if (debugCssDiff) debug("css diff %s: %s", file, summarizeStringDiff(rawSource, generated.css));
|
|
1161
1196
|
debug("css generated result: %s bytes=%d", file, generated.css.length);
|
|
1162
1197
|
recordCssAssetResult?.(file, generated.css);
|
|
@@ -1280,7 +1315,7 @@ function createGenerateBundleHook(context) {
|
|
|
1280
1315
|
}
|
|
1281
1316
|
}
|
|
1282
1317
|
const cssRuntimeSignature = createCssRuntimeSignature(runtimeSignature, generatorCandidateSignature);
|
|
1283
|
-
if (useIncrementalMode
|
|
1318
|
+
if (useIncrementalMode) for (const [file, rawSource] of getRememberedMainCssSources?.() ?? []) {
|
|
1284
1319
|
if (bundleFiles.includes(file) || getRememberedMainCssSignature?.(file) === cssRuntimeSignature) continue;
|
|
1285
1320
|
tasks.push((async () => {
|
|
1286
1321
|
const start = performance.now();
|
|
@@ -1299,6 +1334,7 @@ function createGenerateBundleHook(context) {
|
|
|
1299
1334
|
const css = generated?.css ?? (await styleHandler(rawSource, cssHandlerOptions)).css;
|
|
1300
1335
|
setRememberedMainCssSignature?.(file, cssRuntimeSignature);
|
|
1301
1336
|
if (generated) {
|
|
1337
|
+
registerGeneratorDependencies({ addWatchFile }, generated.dependencies);
|
|
1302
1338
|
recordCssAssetResult?.(file, generated.css);
|
|
1303
1339
|
debug("css replay generated result: %s bytes=%d", file, css.length);
|
|
1304
1340
|
}
|
|
@@ -1551,6 +1587,34 @@ function resolveImplicitAppTypeFromViteRoot(root) {
|
|
|
1551
1587
|
}
|
|
1552
1588
|
}
|
|
1553
1589
|
//#endregion
|
|
1590
|
+
//#region src/bundlers/shared/css-imports.ts
|
|
1591
|
+
const tailwindcssImportRE = /^tailwindcss(?:\/.*)?$/;
|
|
1592
|
+
const tailwindcssCssImportStatementRE = /(@import\s+(?:url\(\s*)?)(["'])(tailwindcss(?:\/[^"']*)?\$?)(\2\s*\)?)/gi;
|
|
1593
|
+
function normalizeTailwindcssSpecifier(specifier) {
|
|
1594
|
+
if (specifier === "tailwindcss$") return "tailwindcss";
|
|
1595
|
+
return specifier;
|
|
1596
|
+
}
|
|
1597
|
+
function getTailwindcssSubpath(specifier) {
|
|
1598
|
+
if (specifier === "tailwindcss") return "index.css";
|
|
1599
|
+
return specifier.slice(12);
|
|
1600
|
+
}
|
|
1601
|
+
function resolveTailwindcssImport(specifier, pkgDir, options) {
|
|
1602
|
+
const normalized = normalizeTailwindcssSpecifier(specifier);
|
|
1603
|
+
if (!tailwindcssImportRE.test(normalized)) return null;
|
|
1604
|
+
if (normalized === "tailwindcss") return options?.rootImport ?? "weapp-tailwindcss/index.css";
|
|
1605
|
+
return (options?.join ?? path.join)(pkgDir, getTailwindcssSubpath(normalized));
|
|
1606
|
+
}
|
|
1607
|
+
function rewriteTailwindcssImportsInCode(code, pkgDir, options) {
|
|
1608
|
+
let hasReplacements = false;
|
|
1609
|
+
const rewritten = code.replace(tailwindcssCssImportStatementRE, (full, prefix, quote, specifier, suffix) => {
|
|
1610
|
+
const replacement = resolveTailwindcssImport(specifier, pkgDir, options);
|
|
1611
|
+
if (!replacement) return full;
|
|
1612
|
+
hasReplacements = true;
|
|
1613
|
+
return `${prefix}${quote}${replacement}${suffix}`;
|
|
1614
|
+
});
|
|
1615
|
+
return hasReplacements ? rewritten : void 0;
|
|
1616
|
+
}
|
|
1617
|
+
//#endregion
|
|
1554
1618
|
//#region src/bundlers/vite/rewrite-css-imports.ts
|
|
1555
1619
|
function joinPosixPath(base, subpath) {
|
|
1556
1620
|
if (base.endsWith("/")) return `${base}${subpath}`;
|
|
@@ -1561,9 +1625,12 @@ function isCssLikeImporter(importer) {
|
|
|
1561
1625
|
const normalized = cleanUrl$1(importer);
|
|
1562
1626
|
return isCSSRequest(normalized) || normalized.endsWith("/*");
|
|
1563
1627
|
}
|
|
1628
|
+
function stripTailwindConfigDirectives(code) {
|
|
1629
|
+
return code.replace(/^\s*@config\s+(?:"[^"]+"|'[^']+')[^;\n]*;\s*$/gm, "");
|
|
1630
|
+
}
|
|
1564
1631
|
function createRewriteCssImportsPlugins(options) {
|
|
1565
1632
|
if (!options.shouldRewrite) return [];
|
|
1566
|
-
const { appType, getAppType, rootImport, weappTailwindcssDirPosix } = options;
|
|
1633
|
+
const { appType, getAppType, rootImport, shouldOwnTailwindGeneration, weappTailwindcssDirPosix } = options;
|
|
1567
1634
|
const resolveAppType = () => getAppType?.() ?? appType;
|
|
1568
1635
|
return [{
|
|
1569
1636
|
name: `${vitePluginName}:rewrite-css-imports`,
|
|
@@ -1590,9 +1657,10 @@ function createRewriteCssImportsPlugins(options) {
|
|
|
1590
1657
|
appType: resolveAppType(),
|
|
1591
1658
|
rootImport
|
|
1592
1659
|
});
|
|
1593
|
-
|
|
1660
|
+
const nextCode = shouldOwnTailwindGeneration ? stripTailwindConfigDirectives(rewritten ?? code) : rewritten;
|
|
1661
|
+
if (!nextCode || nextCode === code) return null;
|
|
1594
1662
|
return {
|
|
1595
|
-
code:
|
|
1663
|
+
code: nextCode,
|
|
1596
1664
|
map: null
|
|
1597
1665
|
};
|
|
1598
1666
|
}
|
|
@@ -1856,24 +1924,24 @@ function resolveImplicitTailwindcssBasedirFromViteRoot(root) {
|
|
|
1856
1924
|
return resolvedRoot;
|
|
1857
1925
|
}
|
|
1858
1926
|
/**
|
|
1859
|
-
* @name
|
|
1927
|
+
* @name WeappTailwindcss
|
|
1860
1928
|
* @description uni-app vite / uni-app-x 版本插件
|
|
1861
1929
|
* @link https://tw.icebreaker.top/docs/quick-start/frameworks/uni-app-vite
|
|
1862
1930
|
*/
|
|
1863
|
-
function
|
|
1931
|
+
function WeappTailwindcss(options = {}) {
|
|
1864
1932
|
const hasExplicitAppType = typeof options.appType === "string" && options.appType.trim().length > 0;
|
|
1865
|
-
const rewriteCssImportsSpecified = Object.hasOwn(options, "rewriteCssImports");
|
|
1866
1933
|
const hasExplicitTailwindcssBasedir = typeof options.tailwindcssBasedir === "string" && options.tailwindcssBasedir.trim().length > 0;
|
|
1867
1934
|
const opts = getCompilerContext(options);
|
|
1868
1935
|
const { disabled, customAttributes, onLoad, mainCssChunkMatcher, styleHandler, jsHandler, twPatcher: initialTwPatcher, refreshTailwindcssPatcher, uniAppX, disabledDefaultTemplateHandler } = opts;
|
|
1869
1936
|
const uniAppXEnabled = isUniAppXEnabled(uniAppX);
|
|
1870
|
-
const disabledOptions =
|
|
1937
|
+
const disabledOptions = resolvePluginDisabledState(disabled);
|
|
1871
1938
|
const tailwindcssMajorVersion = initialTwPatcher.majorVersion ?? 0;
|
|
1872
|
-
const shouldOwnTailwindGeneration =
|
|
1873
|
-
const shouldRewriteCssImports =
|
|
1939
|
+
const shouldOwnTailwindGeneration = !disabledOptions.plugin;
|
|
1940
|
+
const shouldRewriteCssImports = tailwindcssMajorVersion >= 4;
|
|
1874
1941
|
const rewritePlugins = createRewriteCssImportsPlugins({
|
|
1875
1942
|
getAppType: () => opts.appType,
|
|
1876
1943
|
rootImport: shouldOwnTailwindGeneration ? `${weappTailwindcssDirPosix}/generator-placeholder.css` : void 0,
|
|
1944
|
+
shouldOwnTailwindGeneration,
|
|
1877
1945
|
shouldRewrite: shouldRewriteCssImports,
|
|
1878
1946
|
weappTailwindcssDirPosix
|
|
1879
1947
|
});
|
|
@@ -1910,8 +1978,7 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
|
|
|
1910
1978
|
uniAppX: uniAppXEnabled,
|
|
1911
1979
|
customAttributesEntities,
|
|
1912
1980
|
disabledDefaultTemplateHandler,
|
|
1913
|
-
configPath
|
|
1914
|
-
rewriteCssImports: shouldRewriteCssImports
|
|
1981
|
+
configPath
|
|
1915
1982
|
});
|
|
1916
1983
|
const changed = signature !== runtimeRefreshSignature || optionsKey !== runtimeRefreshOptionsKey;
|
|
1917
1984
|
runtimeRefreshSignature = signature;
|
|
@@ -2183,4 +2250,4 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
|
|
|
2183
2250
|
return plugins;
|
|
2184
2251
|
}
|
|
2185
2252
|
//#endregion
|
|
2186
|
-
export {
|
|
2253
|
+
export { WeappTailwindcss as t };
|
package/dist/vite.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
1
|
export * from './bundlers/vite/index';
|
|
2
|
-
export {
|
|
3
|
-
export { UnifiedViteWeappTailwindcssPlugin as weappTailwindcss } from './bundlers/vite/index';
|
|
2
|
+
export { WeappTailwindcss as weappTailwindcss } from './bundlers/vite/index';
|
|
4
3
|
export type { UserDefinedOptions } from './types';
|
package/dist/vite.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_vite = require("./vite-
|
|
3
|
-
exports.
|
|
4
|
-
exports.
|
|
5
|
-
exports.weappTailwindcss = require_vite.UnifiedViteWeappTailwindcssPlugin;
|
|
2
|
+
const require_vite = require("./vite-BkMGwDeH.js");
|
|
3
|
+
exports.WeappTailwindcss = require_vite.WeappTailwindcss;
|
|
4
|
+
exports.weappTailwindcss = require_vite.WeappTailwindcss;
|
package/dist/vite.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as
|
|
2
|
-
export {
|
|
1
|
+
import { t as WeappTailwindcss } from "./vite-fDM-UQpR.mjs";
|
|
2
|
+
export { WeappTailwindcss, WeappTailwindcss as weappTailwindcss };
|
|
@@ -47,7 +47,7 @@ function joinPosixPath(base, subpath) {
|
|
|
47
47
|
return `${base}/${subpath}`;
|
|
48
48
|
}
|
|
49
49
|
function applyCssImportRewrite(source, options) {
|
|
50
|
-
const rewriteOptions = options?.
|
|
50
|
+
const rewriteOptions = options?.tailwindcssImportRewrite;
|
|
51
51
|
const pkgDir = rewriteOptions?.pkgDir;
|
|
52
52
|
if (!pkgDir) return source;
|
|
53
53
|
return rewriteTailwindcssImportsInCode(source, (0, _weapp_tailwindcss_shared.ensurePosix)(pkgDir), {
|