weapp-tailwindcss 5.2.14 → 5.3.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/README.md +55 -8
- package/README.zh-CN.md +64 -0
- package/dist/bundlers/rspack/rule-match.d.ts +13 -0
- package/dist/bundlers/vite/generate-bundle/root-style-output.d.ts +7 -0
- package/dist/bundlers/vite/shared/create-framework-plugins.d.ts +1 -0
- package/dist/bundlers/vite/shared/framework-plugin-order.d.ts +2 -0
- package/dist/{transform-BiHG42Rp.cjs → component-local-style-BirkN5f8.cjs} +33 -168
- package/dist/{transform-52FLRu-0.js → component-local-style-CFL4ClhS.js} +22 -174
- package/dist/generator/index.d.ts +2 -2
- package/dist/generator.cjs +7 -0
- package/dist/generator.js +2 -2
- package/dist/{gulp-DzIR7eO3.cjs → gulp-B0qcNiuP.cjs} +2 -2
- package/dist/{gulp-DG6cWPF4.js → gulp-D1vDx4H1.js} +1 -1
- package/dist/gulp.cjs +1 -1
- package/dist/gulp.js +1 -1
- package/dist/{hmr-timing-CoyM6Dg2.js → hmr-timing-Dq1_msos.js} +5 -7
- package/dist/{hmr-timing-BIPr9t9m.cjs → hmr-timing-pF6k35pP.cjs} +1 -1
- package/dist/index.cjs +3 -3
- package/dist/index.js +3 -3
- package/dist/{pipeline-helpers-Bp343-ik.cjs → pipeline-helpers-DA5-EzbO.cjs} +1 -1
- package/dist/rspack.cjs +124 -7
- package/dist/rspack.js +124 -7
- package/dist/{source-candidate-scan-signature-J9EW91KX.cjs → source-candidate-scan-signature-DGQufJk3.cjs} +1 -1
- package/dist/{source-candidate-scan-signature-BLXoEZN5.js → source-candidate-scan-signature-DSsjYtlq.js} +1 -1
- package/dist/tailwindcss/candidates.d.ts +2 -2
- package/dist/transform-BYhgJszj.cjs +200 -0
- package/dist/transform-Ck31voUU.js +201 -0
- package/dist/uni-app-x/component-local-style.d.ts +3 -1
- package/dist/uni-app-x/transform.d.ts +2 -0
- package/dist/uni-app-x/vite/style-request.d.ts +1 -0
- package/dist/uni-app-x/vite/web-local-style.d.ts +6 -0
- package/dist/{v4-generation-core-CCnEsAgV.cjs → v4-generation-core-BEYGV4eB.cjs} +5 -7
- package/dist/{vite-DNTQV3gN.js → vite-DBgbFsei.js} +184 -64
- package/dist/{vite-RJpkDte7.cjs → vite-jftHIupF.cjs} +184 -64
- package/dist/vite.cjs +1 -1
- package/dist/vite.js +1 -1
- package/dist/weapp-tw-css-import-rewrite-loader.cjs +2 -2
- package/dist/{webpack-DYoIysDo.js → webpack-BSIWFzAA.js} +3 -3
- package/dist/{webpack-BY5y7f0X.cjs → webpack-DhwW2cva.cjs} +4 -4
- package/dist/webpack.cjs +1 -1
- package/dist/webpack.js +1 -1
- package/package.json +9 -14
- package/README.en.md +0 -17
- package/bin/weapp-tailwindcss.cjs +0 -8
- package/dist/cli/context.d.ts +0 -3
- package/dist/cli/doctor/constants.d.ts +0 -7
- package/dist/cli/doctor/types.d.ts +0 -31
- package/dist/cli/doctor.d.ts +0 -4
- package/dist/cli/helpers/options/format.d.ts +0 -2
- package/dist/cli/helpers/options/parse.d.ts +0 -3
- package/dist/cli/helpers/options/resolve.d.ts +0 -1
- package/dist/cli/helpers/options.d.ts +0 -3
- package/dist/cli/helpers.d.ts +0 -4
- package/dist/cli/mount-options.d.ts +0 -4
- package/dist/cli/types.d.ts +0 -15
- package/dist/cli/vscode-entry.d.ts +0 -14
- package/dist/cli.cjs +0 -37065
- package/dist/cli.d.ts +0 -1
- package/dist/cli.js +0 -2298
|
@@ -4848,9 +4848,9 @@ function resolveCompilationDependencies(dependencies) {
|
|
|
4848
4848
|
}));
|
|
4849
4849
|
}
|
|
4850
4850
|
async function executeGeneratorPipeline(context) {
|
|
4851
|
-
return runCompilerOwnerActivity(context.runtimeState, () => executeGeneratorPipelineWithOwner(context));
|
|
4851
|
+
return runCompilerOwnerActivity(context.runtimeState, () => executeGeneratorPipelineWithOwner(context, getCompilationSessionPool(context.runtimeState), getTailwindGenerationSessionPool(context.runtimeState)));
|
|
4852
4852
|
}
|
|
4853
|
-
async function executeGeneratorPipelineWithOwner(context) {
|
|
4853
|
+
async function executeGeneratorPipelineWithOwner(context, compilationPool, generationSession) {
|
|
4854
4854
|
const { cssHandlerOptions, debug, file, generatorBranch, generatorOptions, generatorRawSource, getSourceCandidatesForEntries, hasGeneratedCss, hasGeneratedMarkers, localImports, majorVersion, normalizeGeneratorSource, normalizedCssSources, options, opts, runtime, runtimeState, useMiniProgramCssBranch } = context;
|
|
4855
4855
|
await runtimeState.readyPromise;
|
|
4856
4856
|
const currentCssCandidates = collectGeneratorCssCandidates(generatorRawSource);
|
|
@@ -4873,7 +4873,6 @@ async function executeGeneratorPipelineWithOwner(context) {
|
|
|
4873
4873
|
const generatorStyleOptions = resolveGeneratorStyleOptions(opts, cssHandlerOptions, generatorOptions.styleOptions);
|
|
4874
4874
|
const configuredContainerCompat = hasConfiguredContainerCompatSources(generatorSourceRecords.map((record) => record.source));
|
|
4875
4875
|
const sourceConcurrency = resolveGeneratorSourceConcurrency();
|
|
4876
|
-
const generationSession = getTailwindGenerationSessionPool(runtimeState);
|
|
4877
4876
|
const preparedGenerationInputs = (await runWithConcurrency(generatorSourceRecords.map((record, index) => async () => {
|
|
4878
4877
|
const { metadata: sourceMetadata, source } = record;
|
|
4879
4878
|
const sourceCss = options.deferCssAdaptation ? (0, _weapp_tailwindcss_postcss.removeMatchingLocalCssImports)(source.css, localImports) : source.css;
|
|
@@ -4933,7 +4932,7 @@ async function executeGeneratorPipelineWithOwner(context) {
|
|
|
4933
4932
|
let compilationRevision;
|
|
4934
4933
|
let generated;
|
|
4935
4934
|
if (options.compilation?.enabled) {
|
|
4936
|
-
const execution = await
|
|
4935
|
+
const execution = await compilationPool.run({
|
|
4937
4936
|
scope: options.compilation.scope,
|
|
4938
4937
|
outputId: options.outputFile ?? file,
|
|
4939
4938
|
changes: options.compilation.changes,
|
|
@@ -5189,9 +5188,9 @@ async function generateCssByGenerator(options) {
|
|
|
5189
5188
|
//#endregion
|
|
5190
5189
|
//#region src/bundlers/shared/generator-css/validate.ts
|
|
5191
5190
|
async function validateCandidatesByGenerator(options) {
|
|
5192
|
-
return runCompilerOwnerActivity(options.runtimeState, () => validateCandidatesByGeneratorWithOwner(options));
|
|
5191
|
+
return runCompilerOwnerActivity(options.runtimeState, () => validateCandidatesByGeneratorWithOwner(options, getTailwindGenerationSessionPool(options.runtimeState)));
|
|
5193
5192
|
}
|
|
5194
|
-
async function validateCandidatesByGeneratorWithOwner(options) {
|
|
5193
|
+
async function validateCandidatesByGeneratorWithOwner(options, generationSession) {
|
|
5195
5194
|
const { candidates, cssHandlerOptions, debug, file, opts, rawSource, runtimeState } = options;
|
|
5196
5195
|
const majorVersion = runtimeState.tailwindRuntime.majorVersion;
|
|
5197
5196
|
if (majorVersion !== 4 || candidates.size === 0) return /* @__PURE__ */ new Set();
|
|
@@ -5206,7 +5205,6 @@ async function validateCandidatesByGeneratorWithOwner(options) {
|
|
|
5206
5205
|
cssEntries: opts.cssEntries,
|
|
5207
5206
|
runtime: candidates
|
|
5208
5207
|
});
|
|
5209
|
-
const generationSession = getTailwindGenerationSessionPool(runtimeState);
|
|
5210
5208
|
const classSets = await Promise.all(sourceRecords.map(async ({ source }) => {
|
|
5211
5209
|
return generationSession.validateCandidates(source, candidates);
|
|
5212
5210
|
}));
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { resolveImplicitAppTypeFromViteRoot } from "./framework.js";
|
|
2
|
-
import { $ as hasTailwindSourceDirectives, B as stripMiniProgramCssSpecificityPlaceholders, D as resolveTailwindcssOptions, Ft as filterUnsupportedMiniProgramTailwindV4Candidates, K as hasUserCssLayerBlocks, L as hasMiniProgramCssSpecificityPlaceholders, Ot as resolveSourceScanPath, Pt as getTailwindV4IncrementalGenerateCacheStats, Q as hasTailwindRootDirectives, S as findNearestPackageRoot, U as normalizeEmptyTailwindCustomVariants, X as hasTailwindApplyDirective, Y as hasLocalCssImport, Z as hasTailwindNonRootGenerationDirectives, _ as upsertTailwindV4CssSource, a as resolveGeneratorRuntimeBranch, b as isTailwindV4CssEntry, c as shouldUseNativeAppCssBranch, et as normalizeTailwindConfigDirectives, h as hasConfiguredTailwindV4CssRoots, i as normalizeWeappTailwindcssGeneratorOptions, it as removeTailwindSourceDirectives, kt as resolveTailwindV4CssSourceBase, l as resolveUniUtsPlatform, m as filterTailwindV4CssSourceRoots, mt as stripGeneratorPlaceholderMarkers, nt as normalizeTailwindSourceForGenerator, q as splitUserCssLayerBlocks, rt as parseImportRequest, s as shouldUseMiniProgramCssBranch, ut as hasTailwindGeneratedCssMarkers, wt as isFileMatchedByTailwindSourceEntries, x as normalizeCssEntries } from "./generator-BP4WmgIo.js";
|
|
2
|
+
import { $ as hasTailwindSourceDirectives, B as stripMiniProgramCssSpecificityPlaceholders, D as resolveTailwindcssOptions, Ft as filterUnsupportedMiniProgramTailwindV4Candidates, K as hasUserCssLayerBlocks, L as hasMiniProgramCssSpecificityPlaceholders, Ot as resolveSourceScanPath, Pt as getTailwindV4IncrementalGenerateCacheStats, Q as hasTailwindRootDirectives, S as findNearestPackageRoot, U as normalizeEmptyTailwindCustomVariants, X as hasTailwindApplyDirective, Y as hasLocalCssImport, Z as hasTailwindNonRootGenerationDirectives, _ as upsertTailwindV4CssSource, a as resolveGeneratorRuntimeBranch, b as isTailwindV4CssEntry, c as shouldUseNativeAppCssBranch, et as normalizeTailwindConfigDirectives, h as hasConfiguredTailwindV4CssRoots, i as normalizeWeappTailwindcssGeneratorOptions, it as removeTailwindSourceDirectives, kt as resolveTailwindV4CssSourceBase, l as resolveUniUtsPlatform, lt as hasTailwindGeneratedCss, m as filterTailwindV4CssSourceRoots, mt as stripGeneratorPlaceholderMarkers, nt as normalizeTailwindSourceForGenerator, q as splitUserCssLayerBlocks, rt as parseImportRequest, s as shouldUseMiniProgramCssBranch, ut as hasTailwindGeneratedCssMarkers, wt as isFileMatchedByTailwindSourceEntries, x as normalizeCssEntries } from "./generator-BP4WmgIo.js";
|
|
3
3
|
import { t as omitUndefined } from "./object-B-8IHefx.js";
|
|
4
4
|
import { a as findTailwindConfig, f as resolveSourceScanEntries, g as resolveTailwindV4EntriesFromCssCached, i as resolveUniAppXOptions, l as getRuntimeClassSetSignature, m as resolveTailwindV4CssDependencies, p as discoverTailwindV4CssEntries, r as isUniAppXEnabled } from "./tailwindcss-C2K-vjJv.js";
|
|
5
5
|
import "./utils-MVwpU07P.js";
|
|
6
|
-
import { A as annotateCssSourceTrace, C as stripRequestQuery, D as stripBundlerGeneratedCssMarkers, E as parseBundlerGeneratedCssMarkerBlocks, F as createRuntimeClassSetManager, H as buildRuntimeCompilationSnapshot, J as createRuntimeAffectingSourceSignature, M as createCssTokenSourceMap, O as finalizeMiniProgramCssStructure, P as processCachedTask, Q as AssetEmissionPlan, R as isPureLocalCssImportWrapper, S as isSourceStyleRequest, T as hasBundlerGeneratedCssMarker, V as finalizeCompilerShadowRun, W as createRuntimeCompilationBuildState, X as beginCompilerShadowRun, Y as disposeCompilerOwner, a as extractMarkedUserLayerComponentsCss, at as isSourceCandidateRequest, d as runWithConcurrency, f as normalizeMiniProgramGeneratorCssSource, g as captureFrameworkPostcssOptions, i as validateCandidatesByGenerator, j as createCssSourceTraceCacheSignature, k as hasEmptyAtRuleBlockCandidate, m as scoreTailwindV4CssSourceFileMatch, nt as createCompilationDependencyChanges, o as mergeMarkedUserLayerComponentsCss, ot as extractCandidatesFromSource, p as normalizeMiniProgramImportShell, q as updateRuntimeCompilationBuildState, r as generateTailwindV4Css, rt as createSourceCandidateCollector, s as collectGeneratedRawSourceCandidatesFromCss, st as createSourceCandidateEligibilityMatcher, t as createHmrTimingRecorder, tt as recordCompilationDependencyChanges, w as createBundlerGeneratedCssMarker } from "./hmr-timing-
|
|
6
|
+
import { A as annotateCssSourceTrace, C as stripRequestQuery, D as stripBundlerGeneratedCssMarkers, E as parseBundlerGeneratedCssMarkerBlocks, F as createRuntimeClassSetManager, H as buildRuntimeCompilationSnapshot, J as createRuntimeAffectingSourceSignature, M as createCssTokenSourceMap, O as finalizeMiniProgramCssStructure, P as processCachedTask, Q as AssetEmissionPlan, R as isPureLocalCssImportWrapper, S as isSourceStyleRequest, T as hasBundlerGeneratedCssMarker, V as finalizeCompilerShadowRun, W as createRuntimeCompilationBuildState, X as beginCompilerShadowRun, Y as disposeCompilerOwner, a as extractMarkedUserLayerComponentsCss, at as isSourceCandidateRequest, d as runWithConcurrency, f as normalizeMiniProgramGeneratorCssSource, g as captureFrameworkPostcssOptions, i as validateCandidatesByGenerator, j as createCssSourceTraceCacheSignature, k as hasEmptyAtRuleBlockCandidate, m as scoreTailwindV4CssSourceFileMatch, nt as createCompilationDependencyChanges, o as mergeMarkedUserLayerComponentsCss, ot as extractCandidatesFromSource, p as normalizeMiniProgramImportShell, q as updateRuntimeCompilationBuildState, r as generateTailwindV4Css, rt as createSourceCandidateCollector, s as collectGeneratedRawSourceCandidatesFromCss, st as createSourceCandidateEligibilityMatcher, t as createHmrTimingRecorder, tt as recordCompilationDependencyChanges, w as createBundlerGeneratedCssMarker } from "./hmr-timing-Dq1_msos.js";
|
|
7
7
|
import { m as createDebug, p as replaceWxml } from "./wxml-B7OAVpXJ.js";
|
|
8
8
|
import { a as vitePluginName, c as collectRuntimeClassSet, d as refreshTailwindRuntimeState, f as normalizeFrameworkStylePlatform, l as createTailwindRuntimeReadyPromise, n as normalizeStyleHandlerMajorVersion, o as shouldSkipJsTransform, s as toCustomAttributesEntities, t as getCompilerContext } from "./context-CKQKq4Mv.js";
|
|
9
|
-
import { _ as createBuiltinViteStyleInjectorPlugins, a as createCandidateSignature, c as getSnapshotHash, d as classifyRuntimeEntry, f as resolvePackageDir, g as toAbsoluteOutputPath, h as resolveOutputSpecifier, i as createScopedGeneratorSourceTraceMap, l as hasRuntimeAffectingSourceChanges, m as normalizeOutputPathKey, n as createScopedGeneratorCandidateSignature, o as createJsHashSalt, p as resolvePluginDisabledState, r as createScopedGeneratorRuntime, s as createLinkedImpactSignature, t as createSourceCandidateScanSignature, u as summarizeStringDiff, x as resolveViteFrameworkProfile, y as viteStyleInjectorDelegates } from "./source-candidate-scan-signature-
|
|
9
|
+
import { _ as createBuiltinViteStyleInjectorPlugins, a as createCandidateSignature, c as getSnapshotHash, d as classifyRuntimeEntry, f as resolvePackageDir, g as toAbsoluteOutputPath, h as resolveOutputSpecifier, i as createScopedGeneratorSourceTraceMap, l as hasRuntimeAffectingSourceChanges, m as normalizeOutputPathKey, n as createScopedGeneratorCandidateSignature, o as createJsHashSalt, p as resolvePluginDisabledState, r as createScopedGeneratorRuntime, s as createLinkedImpactSignature, t as createSourceCandidateScanSignature, u as summarizeStringDiff, x as resolveViteFrameworkProfile, y as viteStyleInjectorDelegates } from "./source-candidate-scan-signature-DSsjYtlq.js";
|
|
10
10
|
import { t as logger$1 } from "./logger-BNzxZbZj.js";
|
|
11
|
+
import { r as shouldEnablePageLocalStyle } from "./component-local-style-CFL4ClhS.js";
|
|
11
12
|
import fs, { existsSync, readFileSync, realpathSync } from "node:fs";
|
|
12
13
|
import path from "node:path";
|
|
13
14
|
import process$1 from "node:process";
|
|
@@ -2811,6 +2812,47 @@ function restoreFrameworkRootMiniProgramImportShellAssets(bundle, options) {
|
|
|
2811
2812
|
});
|
|
2812
2813
|
return restored;
|
|
2813
2814
|
}
|
|
2815
|
+
function resolveRuntimeRootStyleOutputFile(bundle, matchesCss) {
|
|
2816
|
+
const rootChunks = Object.entries(bundle).flatMap(([bundleFile, output]) => {
|
|
2817
|
+
if (output.type !== "chunk") return [];
|
|
2818
|
+
const file = normalizeOutputPathKey(output.fileName || bundleFile);
|
|
2819
|
+
if (file.includes("/")) return [];
|
|
2820
|
+
return [{
|
|
2821
|
+
file,
|
|
2822
|
+
isEntry: output.isEntry === true
|
|
2823
|
+
}];
|
|
2824
|
+
});
|
|
2825
|
+
const entryChunks = rootChunks.filter((chunk) => chunk.isEntry);
|
|
2826
|
+
const rootChunkStems = new Set((entryChunks.length > 0 ? entryChunks : rootChunks).map((chunk) => path.posix.parse(chunk.file).name));
|
|
2827
|
+
const candidates = Object.entries(bundle).flatMap(([bundleFile, output]) => {
|
|
2828
|
+
if (output.type !== "asset") return [];
|
|
2829
|
+
const file = normalizeOutputPathKey(output.fileName || bundleFile);
|
|
2830
|
+
return isRootMiniProgramStyleOutputFile$1(file) && matchesCss(file) && rootChunkStems.has(path.posix.parse(file).name) ? [file] : [];
|
|
2831
|
+
});
|
|
2832
|
+
return candidates.length === 1 ? candidates[0] : void 0;
|
|
2833
|
+
}
|
|
2834
|
+
function linkFrameworkRootStyleToRuntimeEntry(bundle, options) {
|
|
2835
|
+
if (options.targetByFile.size === 0) return 0;
|
|
2836
|
+
const runtimeRootFile = resolveRuntimeRootStyleOutputFile(bundle, options.matchesCss);
|
|
2837
|
+
if (!runtimeRootFile) return 0;
|
|
2838
|
+
const frameworkRootFiles = [...options.targetByFile.keys()].filter((file) => normalizeOutputPathKey(file) !== normalizeOutputPathKey(runtimeRootFile) && isRootMiniProgramStyleOutputFile$1(file) && options.matchesCss(file));
|
|
2839
|
+
if (frameworkRootFiles.length !== 1) return 0;
|
|
2840
|
+
const frameworkRootFile = frameworkRootFiles[0];
|
|
2841
|
+
const runtimeOutput = Object.entries(bundle).find(([bundleFile, output]) => output.type === "asset" && normalizeOutputPathKey(output.fileName || bundleFile) === normalizeOutputPathKey(runtimeRootFile))?.[1];
|
|
2842
|
+
const frameworkOutput = Object.entries(bundle).find(([bundleFile, output]) => output.type === "asset" && normalizeOutputPathKey(output.fileName || bundleFile) === normalizeOutputPathKey(frameworkRootFile))?.[1];
|
|
2843
|
+
if (runtimeOutput?.type !== "asset" || frameworkOutput?.type !== "asset") return 0;
|
|
2844
|
+
const runtimeSource = runtimeOutput.source.toString();
|
|
2845
|
+
const importedRuntimeFile = resolveSingleCssImportOutputFile(runtimeRootFile, runtimeSource);
|
|
2846
|
+
if (importedRuntimeFile && normalizeOutputPathKey(importedRuntimeFile) === normalizeOutputPathKey(frameworkRootFile)) return 0;
|
|
2847
|
+
const importedFrameworkFile = resolveSingleCssImportOutputFile(frameworkRootFile, frameworkOutput.source.toString());
|
|
2848
|
+
if (importedFrameworkFile && normalizeOutputPathKey(importedFrameworkFile) === normalizeOutputPathKey(runtimeRootFile)) return 0;
|
|
2849
|
+
const nextSource = `${createCssImportShell$1(runtimeRootFile, frameworkRootFile)}${runtimeSource}`;
|
|
2850
|
+
runtimeOutput.source = nextSource;
|
|
2851
|
+
options.recordCssAssetResult?.(runtimeRootFile, nextSource);
|
|
2852
|
+
options.onUpdate?.(runtimeRootFile, runtimeSource, nextSource);
|
|
2853
|
+
options.debug?.("link framework root css to runtime entry: %s -> %s", runtimeRootFile, frameworkRootFile);
|
|
2854
|
+
return 1;
|
|
2855
|
+
}
|
|
2814
2856
|
function shouldMoveRootMiniProgramStyleToImportShellOrigin(enabled) {
|
|
2815
2857
|
return enabled === true;
|
|
2816
2858
|
}
|
|
@@ -6169,6 +6211,8 @@ const INLINE_LANG_RE = /lang\.([a-z]+)/i;
|
|
|
6169
6211
|
const PREPROCESSOR_EXT_RE = /\.(?:scss|sass|less|styl|stylus)(?:\?|$)/i;
|
|
6170
6212
|
const UVUE_NVUE_RE$1 = /\.(?:uvue|nvue)$/;
|
|
6171
6213
|
const CSS_MODULE_EXPORT_RE = /^\s*export\s+default\s+(?:\{|\w|\[\])/;
|
|
6214
|
+
const RELATIVE_REFERENCE_RE = /@reference\s+(["'])(\.\.?[\\/][^"']+)\1\s*;?/g;
|
|
6215
|
+
const WINDOWS_ABSOLUTE_PATH_RE = /^[a-z]:[\\/]/i;
|
|
6172
6216
|
function isPreprocessorRequest(id, lang) {
|
|
6173
6217
|
const normalizedLang = lang?.toLowerCase();
|
|
6174
6218
|
if (normalizedLang && preprocessorLangs.has(normalizedLang)) return true;
|
|
@@ -6182,6 +6226,15 @@ function resolveUniAppXCssTarget(id) {
|
|
|
6182
6226
|
function isCssModuleExport(code) {
|
|
6183
6227
|
return CSS_MODULE_EXPORT_RE.test(code);
|
|
6184
6228
|
}
|
|
6229
|
+
function normalizeRelativeTailwindReferences(code, id) {
|
|
6230
|
+
if (!code.includes("@reference")) return code;
|
|
6231
|
+
const sourceFile = cleanUrl(id);
|
|
6232
|
+
const pathApi = WINDOWS_ABSOLUTE_PATH_RE.test(sourceFile) ? path.win32 : path;
|
|
6233
|
+
const sourceDir = pathApi.dirname(sourceFile);
|
|
6234
|
+
return code.replace(RELATIVE_REFERENCE_RE, (_full, quote, request) => {
|
|
6235
|
+
return `@reference ${quote}${pathApi.resolve(sourceDir, request).replace(/\\/g, "/")}${quote};`;
|
|
6236
|
+
});
|
|
6237
|
+
}
|
|
6185
6238
|
function resolvePreprocessorTransform(code, id, lang, options) {
|
|
6186
6239
|
if (!isPreprocessorRequest(id, lang)) return;
|
|
6187
6240
|
if (options.isIosPlatform) {
|
|
@@ -6194,10 +6247,36 @@ function resolvePreprocessorTransform(code, id, lang, options) {
|
|
|
6194
6247
|
if (options.isWebGeneratorTarget && !options.isNativeAppStyleTarget) return { result: void 0 };
|
|
6195
6248
|
}
|
|
6196
6249
|
//#endregion
|
|
6250
|
+
//#region src/uni-app-x/vite/web-local-style.ts
|
|
6251
|
+
function isStyleModule(mod) {
|
|
6252
|
+
const request = mod.id ?? mod.url;
|
|
6253
|
+
return typeof request === "string" && /[?&](?:vue&)?type=style(?:&|$)/.test(request);
|
|
6254
|
+
}
|
|
6255
|
+
function createUniAppXWebLocalStyleBridge(isEnabled) {
|
|
6256
|
+
const rulesByFile = /* @__PURE__ */ new Map();
|
|
6257
|
+
return {
|
|
6258
|
+
appendToStyle(code, id) {
|
|
6259
|
+
if (!isEnabled()) return code;
|
|
6260
|
+
const rules = rulesByFile.get(cleanUrl(id));
|
|
6261
|
+
return rules ? `${code}\n${rules}` : code;
|
|
6262
|
+
},
|
|
6263
|
+
handleHotUpdate(ctx) {
|
|
6264
|
+
if (!isEnabled() || !/\.(?:uvue|nvue)$/i.test(cleanUrl(ctx.file))) return;
|
|
6265
|
+
const styleModules = [...ctx.server.moduleGraph.getModulesByFile?.(ctx.file) ?? []].filter(isStyleModule);
|
|
6266
|
+
if (styleModules.length === 0) return;
|
|
6267
|
+
for (const mod of styleModules) ctx.server.moduleGraph.invalidateModule(mod);
|
|
6268
|
+
return [.../* @__PURE__ */ new Set([...ctx.modules, ...styleModules])];
|
|
6269
|
+
},
|
|
6270
|
+
remember(id, rules) {
|
|
6271
|
+
rulesByFile.set(cleanUrl(id), rules);
|
|
6272
|
+
}
|
|
6273
|
+
};
|
|
6274
|
+
}
|
|
6275
|
+
//#endregion
|
|
6197
6276
|
//#region src/uni-app-x/vite.ts
|
|
6198
6277
|
let transformUVuePromise;
|
|
6199
6278
|
function loadTransformUVue() {
|
|
6200
|
-
transformUVuePromise ?? (transformUVuePromise = import("./transform-
|
|
6279
|
+
transformUVuePromise ?? (transformUVuePromise = import("./transform-Ck31voUU.js").then((mod) => mod.transformUVue));
|
|
6201
6280
|
return transformUVuePromise;
|
|
6202
6281
|
}
|
|
6203
6282
|
const UVUE_NVUE_QUERY_RE = /\.(?:uvue|nvue)(?:\?.*)?$/;
|
|
@@ -6212,6 +6291,7 @@ function createUniAppXPlugins(options) {
|
|
|
6212
6291
|
const isIosPlatform = providedIosPlatform ?? utsPlatform.isAppIos;
|
|
6213
6292
|
const cssHandlerOptionsCache = /* @__PURE__ */ new Map();
|
|
6214
6293
|
const nativeLocalStyleModuleIds = /* @__PURE__ */ new Set();
|
|
6294
|
+
const webLocalStyle = createUniAppXWebLocalStyleBridge(isWebGeneratorTarget);
|
|
6215
6295
|
let componentLocalStyleEnabled;
|
|
6216
6296
|
const isNativeAppBuildTarget = createUniAppXNativeBuildTargetResolver(getResolvedConfig);
|
|
6217
6297
|
const nativeHmrReloader = createUniAppXNativeHmrReloader({
|
|
@@ -6236,8 +6316,8 @@ function createUniAppXPlugins(options) {
|
|
|
6236
6316
|
componentLocalStyleEnabled = resolveUniAppXStyleIsolationEnabled(root);
|
|
6237
6317
|
return componentLocalStyleEnabled;
|
|
6238
6318
|
}
|
|
6239
|
-
function
|
|
6240
|
-
return isNativeAppBuildTarget(id)
|
|
6319
|
+
function shouldEnablePageLocalStyleForFile(id) {
|
|
6320
|
+
return resolvedUniAppXOptions.componentLocalStyles.enabled && (isNativeAppBuildTarget(id) || shouldEnablePageLocalStyle(id));
|
|
6241
6321
|
}
|
|
6242
6322
|
function isHarmonyBuildTarget() {
|
|
6243
6323
|
if (resolveUniUtsPlatform().isAppHarmony) return true;
|
|
@@ -6275,19 +6355,20 @@ function createUniAppXPlugins(options) {
|
|
|
6275
6355
|
const parsed = query ?? parseVueRequest(id).query;
|
|
6276
6356
|
if (isCSSRequest(id) || parsed.vue && parsed.type === "style") {
|
|
6277
6357
|
if (isCssModuleExport(code)) return;
|
|
6278
|
-
const
|
|
6279
|
-
const
|
|
6358
|
+
const sourceCode = normalizeRelativeTailwindReferences(code, id);
|
|
6359
|
+
const hasTailwindRoot = hasTailwindRootDirectives(sourceCode, { importFallback: true });
|
|
6360
|
+
const hasTailwindApply = hasTailwindApplyDirective(sourceCode);
|
|
6280
6361
|
const shouldGenerateCss = hasTailwindRoot || hasTailwindApply;
|
|
6281
6362
|
const isNativeSfcAuthorStyle = isNativeStyle && resolveUniAppXCssTarget(id) === "uvue";
|
|
6282
6363
|
if (!shouldGenerateCss && (!isNativeStyle || isNativeSfcAuthorStyle)) return;
|
|
6283
|
-
harmonyApply.rememberSource(
|
|
6284
|
-
const generatedCss = shouldGenerateCss ? await generateCss?.(id, isNativeSfcAuthorStyle && hasTailwindApply && !hasTailwindRoot ? harmonyApply.prepareStyles(
|
|
6364
|
+
harmonyApply.rememberSource(sourceCode, id);
|
|
6365
|
+
const generatedCss = shouldGenerateCss ? await generateCss?.(id, isNativeSfcAuthorStyle && hasTailwindApply && !hasTailwindRoot ? harmonyApply.prepareStyles(sourceCode, id) : sourceCode, {
|
|
6285
6366
|
...hookContext,
|
|
6286
6367
|
disableSourceScan: isNativeSfcAuthorStyle && hasTailwindApply && !hasTailwindRoot,
|
|
6287
6368
|
sourceCandidates: isNativeSfcAuthorStyle && hasTailwindApply && !hasTailwindRoot ? [] : void 0,
|
|
6288
6369
|
transient: isNativeSfcAuthorStyle && hasTailwindApply && !hasTailwindRoot
|
|
6289
6370
|
}) : void 0;
|
|
6290
|
-
const styleCode = typeof generatedCss === "string" && generatedCss.trim().length > 0 ? hasTailwindApply && !hasTailwindRoot ? retainUniAppXAuthorApplyCss(generatedCss,
|
|
6371
|
+
const styleCode = typeof generatedCss === "string" && generatedCss.trim().length > 0 ? hasTailwindApply && !hasTailwindRoot ? retainUniAppXAuthorApplyCss(generatedCss, sourceCode) : generatedCss : sourceCode;
|
|
6291
6372
|
const styleHandlerOptions = getStyleHandlerOptions(id, isNativeStyle && hasTailwindRoot ? "tailwind-root" : isNativeStyle ? "author-apply" : void 0);
|
|
6292
6373
|
const postcssResult = await styleHandler(styleCode, styleHandlerOptions);
|
|
6293
6374
|
reportStyleWarnings(postcssResult);
|
|
@@ -6322,15 +6403,49 @@ function createUniAppXPlugins(options) {
|
|
|
6322
6403
|
if (!isEnabled()) return;
|
|
6323
6404
|
await runtimeState.readyPromise;
|
|
6324
6405
|
const { query } = parseVueRequest(id);
|
|
6325
|
-
const
|
|
6406
|
+
const styleCode = query.vue && query.type === "style" ? webLocalStyle.appendToStyle(code, id) : code;
|
|
6407
|
+
const preprocessor = resolvePreprocessorTransform(styleCode, id, query.lang, {
|
|
6326
6408
|
isIosPlatform,
|
|
6327
6409
|
isNativeAppStyleTarget: isNativeAppStyleTarget(),
|
|
6328
6410
|
isWebGeneratorTarget: isWebGeneratorTarget()
|
|
6329
6411
|
});
|
|
6330
|
-
if (preprocessor) return preprocessor.result
|
|
6331
|
-
|
|
6412
|
+
if (preprocessor) return preprocessor.result ?? (styleCode !== code ? {
|
|
6413
|
+
code: styleCode,
|
|
6414
|
+
map: null
|
|
6415
|
+
} : void 0);
|
|
6416
|
+
return transformStyle(styleCode, id, query, this);
|
|
6332
6417
|
}
|
|
6333
6418
|
}];
|
|
6419
|
+
async function transformSfc(code, id, context) {
|
|
6420
|
+
if (isNativeAppBuildTarget(id)) {
|
|
6421
|
+
nativeLocalStyleModuleIds.add(id);
|
|
6422
|
+
nativeLocalStyleModuleIds.add(cleanUrl(id));
|
|
6423
|
+
}
|
|
6424
|
+
harmonyApply.rememberSource(code, id, true);
|
|
6425
|
+
const resolvedConfig = getResolvedConfig();
|
|
6426
|
+
const shouldForceRefresh = resolvedConfig?.command === "serve" || resolvedConfig?.command === "build";
|
|
6427
|
+
const currentRuntimeSet = await ensureRuntimeClassSet(shouldForceRefresh);
|
|
6428
|
+
nativeHmrReloader.remember(currentRuntimeSet);
|
|
6429
|
+
const transformUVue = await loadTransformUVue();
|
|
6430
|
+
const enableComponentLocalStyle = shouldEnableComponentLocalStyle();
|
|
6431
|
+
const enablePageLocalStyle = shouldEnablePageLocalStyleForFile(id);
|
|
6432
|
+
const transformOptions = omitUndefined({
|
|
6433
|
+
...customAttributesEntities.length > 0 ? { customAttributesEntities } : {},
|
|
6434
|
+
...disabledDefaultTemplateHandler ? { disabledDefaultTemplateHandler } : {},
|
|
6435
|
+
...enableComponentLocalStyle ? { enableComponentLocalStyle } : {},
|
|
6436
|
+
...enablePageLocalStyle ? { enablePageLocalStyle } : {},
|
|
6437
|
+
...isWebGeneratorTarget() && customAttributesEntities.length > 0 ? { webCustomAttributeDeep: true } : {},
|
|
6438
|
+
...isWebGeneratorTarget() ? { onWebLocalStyleRules: (rules) => webLocalStyle.remember(id, rules) } : {}
|
|
6439
|
+
});
|
|
6440
|
+
const result = Object.keys(transformOptions).length > 0 ? transformUVue(code, id, jsHandler, currentRuntimeSet, transformOptions) : transformUVue(code, id, jsHandler, currentRuntimeSet);
|
|
6441
|
+
if (!result?.code) return result;
|
|
6442
|
+
harmonyApply.rememberSource(result.code, id);
|
|
6443
|
+
const expandedCode = await harmonyApply.expandStyles(result.code, id, context);
|
|
6444
|
+
return expandedCode === result.code ? result : {
|
|
6445
|
+
code: expandedCode,
|
|
6446
|
+
map: null
|
|
6447
|
+
};
|
|
6448
|
+
}
|
|
6334
6449
|
const nvuePlugin = {
|
|
6335
6450
|
name: "weapp-tailwindcss:uni-app-x:nvue",
|
|
6336
6451
|
enforce: "pre",
|
|
@@ -6343,42 +6458,17 @@ function createUniAppXPlugins(options) {
|
|
|
6343
6458
|
async handler(code, id) {
|
|
6344
6459
|
if (!isEnabled()) return;
|
|
6345
6460
|
if (!UVUE_NVUE_QUERY_RE.test(id)) return;
|
|
6346
|
-
|
|
6347
|
-
nativeLocalStyleModuleIds.add(id);
|
|
6348
|
-
nativeLocalStyleModuleIds.add(cleanUrl(id));
|
|
6349
|
-
}
|
|
6350
|
-
harmonyApply.rememberSource(code, id, true);
|
|
6351
|
-
const resolvedConfig = getResolvedConfig();
|
|
6352
|
-
const isServeCommand = resolvedConfig?.command === "serve";
|
|
6353
|
-
const isWatchBuild = resolvedConfig?.command === "build" && !!resolvedConfig.build?.watch;
|
|
6354
|
-
const isNonWatchBuild = resolvedConfig?.command === "build" && !resolvedConfig.build?.watch;
|
|
6355
|
-
const currentRuntimeSet = isServeCommand || isWatchBuild || isNonWatchBuild ? await ensureRuntimeClassSet(true) : await ensureRuntimeClassSet();
|
|
6356
|
-
nativeHmrReloader.remember(currentRuntimeSet);
|
|
6357
|
-
const transformUVue = await loadTransformUVue();
|
|
6358
|
-
const enableComponentLocalStyle = shouldEnableComponentLocalStyle();
|
|
6359
|
-
const enablePageLocalStyle = shouldEnableNativePageLocalStyle(id);
|
|
6360
|
-
const result = customAttributesEntities.length > 0 || disabledDefaultTemplateHandler || enableComponentLocalStyle || enablePageLocalStyle ? transformUVue(code, id, jsHandler, currentRuntimeSet, omitUndefined({
|
|
6361
|
-
...customAttributesEntities.length > 0 ? { customAttributesEntities } : {},
|
|
6362
|
-
...disabledDefaultTemplateHandler ? { disabledDefaultTemplateHandler } : {},
|
|
6363
|
-
...enableComponentLocalStyle ? { enableComponentLocalStyle } : {},
|
|
6364
|
-
...enablePageLocalStyle ? { enablePageLocalStyle } : {}
|
|
6365
|
-
})) : transformUVue(code, id, jsHandler, currentRuntimeSet);
|
|
6366
|
-
if (result?.code) {
|
|
6367
|
-
harmonyApply.rememberSource(result.code, id);
|
|
6368
|
-
const expandedCode = await harmonyApply.expandStyles(result.code, id, this);
|
|
6369
|
-
if (expandedCode !== result.code) return {
|
|
6370
|
-
code: expandedCode,
|
|
6371
|
-
map: null
|
|
6372
|
-
};
|
|
6373
|
-
}
|
|
6374
|
-
return result;
|
|
6461
|
+
return transformSfc(code, id, this);
|
|
6375
6462
|
}
|
|
6376
6463
|
},
|
|
6377
|
-
|
|
6378
|
-
|
|
6379
|
-
|
|
6380
|
-
|
|
6381
|
-
|
|
6464
|
+
handleHotUpdate: {
|
|
6465
|
+
order: "post",
|
|
6466
|
+
async handler(ctx) {
|
|
6467
|
+
if (!isEnabled() || getResolvedConfig()?.command !== "serve") return;
|
|
6468
|
+
if (!UVUE_NVUE_RE.test(ctx.file) && !isCSSRequest(ctx.file)) return;
|
|
6469
|
+
if (isWebGeneratorTarget() && UVUE_NVUE_RE.test(ctx.file) && typeof ctx.read === "function") await transformSfc(await ctx.read(), ctx.file, this);
|
|
6470
|
+
return webLocalStyle.handleHotUpdate(ctx) ?? nativeHmrReloader.handleHotUpdate(ctx);
|
|
6471
|
+
}
|
|
6382
6472
|
},
|
|
6383
6473
|
async watchChange(id) {
|
|
6384
6474
|
if (!isEnabled()) return;
|
|
@@ -8145,15 +8235,25 @@ function resolveProcessedCssAssets(cssAssets, records, options, bundleFiles) {
|
|
|
8145
8235
|
const recordCss = typeof record === "string" ? record : record.css;
|
|
8146
8236
|
const outputFile = typeof record === "string" ? resolveProcessedCssOutputFile(file, options, bundleFiles) : record.outputFile ?? resolveProcessedCssOutputFile(file, options, bundleFiles);
|
|
8147
8237
|
let output = assetBySourceFile.get(normalizeOutputPathKey(file)) ?? (outputFile ? cssAssets.get(normalizeOutputPathKey(outputFile)) : void 0);
|
|
8238
|
+
let useAssetSource = output !== void 0;
|
|
8148
8239
|
if (!output) {
|
|
8149
8240
|
const matchingAssets = [...cssAssets.values()].filter((candidate) => options.context.isCssAssetProcessed(candidate.asset, candidate.file) && resolveViteProcessedCssAssetSource(candidate.file, candidate.original, (sourceFile) => resolveProcessedCssOutputFile(sourceFile, options, bundleFiles)) === recordCss);
|
|
8150
|
-
if (matchingAssets.length === 1)
|
|
8241
|
+
if (matchingAssets.length === 1) {
|
|
8242
|
+
output = matchingAssets[0];
|
|
8243
|
+
useAssetSource = true;
|
|
8244
|
+
}
|
|
8245
|
+
}
|
|
8246
|
+
if (!output && records.length === 1 && htmlOwnedAssets.length === 1) {
|
|
8247
|
+
output = htmlOwnedAssets[0];
|
|
8248
|
+
useAssetSource = hasTailwindGeneratedCss(output.original) || hasTailwindGeneratedCssMarkers(output.original);
|
|
8151
8249
|
}
|
|
8152
|
-
if (!output && records.length === 1 && htmlOwnedAssets.length === 1) output = htmlOwnedAssets[0];
|
|
8153
8250
|
if (!output) return;
|
|
8154
|
-
const
|
|
8155
|
-
if (
|
|
8156
|
-
processedAssets.set(output,
|
|
8251
|
+
const existing = processedAssets.get(output);
|
|
8252
|
+
if (existing !== void 0 && existing.css !== recordCss) return;
|
|
8253
|
+
processedAssets.set(output, {
|
|
8254
|
+
css: recordCss,
|
|
8255
|
+
useAssetSource
|
|
8256
|
+
});
|
|
8157
8257
|
}
|
|
8158
8258
|
return processedAssets;
|
|
8159
8259
|
}
|
|
@@ -8183,9 +8283,10 @@ function tryFinalizeGenericWebCss(options) {
|
|
|
8183
8283
|
options.recordTiming("processedCss.collect", collectStartedAt);
|
|
8184
8284
|
if (!processedAssets) return false;
|
|
8185
8285
|
const writeStartedAt = performance.now();
|
|
8186
|
-
for (const [{ asset, file, original },
|
|
8286
|
+
for (const [{ asset, file, original }, processed] of processedAssets) {
|
|
8187
8287
|
const finalizeStartedAt = performance.now();
|
|
8188
|
-
const
|
|
8288
|
+
const finalCssSource = processed.useAssetSource ? original : processed.css;
|
|
8289
|
+
const generated = finalizeWebCss(stripBundlerGeneratedCssMarkers(finalCssSource), {
|
|
8189
8290
|
...options.createCssPipelineContext(file),
|
|
8190
8291
|
file
|
|
8191
8292
|
}, context.cssPipelineStrategy);
|
|
@@ -8299,6 +8400,13 @@ function createViteCssFinalizerOutputPlugin(context) {
|
|
|
8299
8400
|
}),
|
|
8300
8401
|
targetByFile: frameworkRootImportShellTargetByFile ?? /* @__PURE__ */ new Map()
|
|
8301
8402
|
});
|
|
8403
|
+
if (!isWebGeneratorTarget) linkFrameworkRootStyleToRuntimeEntry(bundle, {
|
|
8404
|
+
debug,
|
|
8405
|
+
matchesCss: opts.cssMatcher,
|
|
8406
|
+
onUpdate: trackFinalCssAssetUpdate,
|
|
8407
|
+
recordCssAssetResult,
|
|
8408
|
+
targetByFile: frameworkRootImportShellTargetByFile ?? /* @__PURE__ */ new Map()
|
|
8409
|
+
});
|
|
8302
8410
|
const sourceTraceTokenSources = getSourceCandidateSourcesForEntries ? createCssTokenSourceMap(getSourceCandidateSourcesForEntries(void 0), opts) : void 0;
|
|
8303
8411
|
const annotateCss = (css) => annotateCssSourceTrace(css, {
|
|
8304
8412
|
opts,
|
|
@@ -9357,6 +9465,22 @@ function createViteHmrCandidateState(options) {
|
|
|
9357
9465
|
};
|
|
9358
9466
|
}
|
|
9359
9467
|
//#endregion
|
|
9468
|
+
//#region src/bundlers/vite/shared/framework-plugin-order.ts
|
|
9469
|
+
function orderFrameworkSourceCandidatePlugins(extraPlugins, rewritePlugins, sourceCandidatesPlugin, beforeExtraPlugin) {
|
|
9470
|
+
const anchor = beforeExtraPlugin ? extraPlugins.findIndex(beforeExtraPlugin) : -1;
|
|
9471
|
+
if (anchor < 0) return [
|
|
9472
|
+
...extraPlugins,
|
|
9473
|
+
...rewritePlugins,
|
|
9474
|
+
sourceCandidatesPlugin
|
|
9475
|
+
];
|
|
9476
|
+
return [
|
|
9477
|
+
...extraPlugins.slice(0, anchor),
|
|
9478
|
+
...rewritePlugins,
|
|
9479
|
+
sourceCandidatesPlugin,
|
|
9480
|
+
...extraPlugins.slice(anchor)
|
|
9481
|
+
];
|
|
9482
|
+
}
|
|
9483
|
+
//#endregion
|
|
9360
9484
|
//#region src/bundlers/vite/official-tailwind-plugins.ts
|
|
9361
9485
|
function isTailwindVitePlugin(plugin) {
|
|
9362
9486
|
if (!plugin || typeof plugin !== "object" || !("name" in plugin)) return false;
|
|
@@ -9697,7 +9821,7 @@ function createFrameworkSourceCandidatesPlugin(options) {
|
|
|
9697
9821
|
const hotRoot = ctx.server.config?.root ?? process$1.cwd();
|
|
9698
9822
|
const sourceModules = isSourceCandidateHotUpdate && !isSourceStyleRequest(ctx.file) ? await resolveHotSourceModules(ctx) : ctx.modules;
|
|
9699
9823
|
if (isWebLikeHotUpdate && isSourceCandidateHotUpdate && !isSourceStyleRequest(ctx.file)) {
|
|
9700
|
-
sendSupplementalSourceHotUpdates(ctx, sourceModules);
|
|
9824
|
+
if (!/\.(?:uvue|nvue)$/i.test(cleanUrl(ctx.file))) sendSupplementalSourceHotUpdates(ctx, sourceModules);
|
|
9701
9825
|
if (sourceModules.some((mod) => {
|
|
9702
9826
|
const id = mod.id ?? mod.url;
|
|
9703
9827
|
return typeof id === "string" && /[?&]macro=true(?:&|$)/.test(id) === false && typeof mod.url === "string" && mod.url.startsWith("/pages/") && /\.vue(?:$|[?#])/i.test(id);
|
|
@@ -10033,9 +10157,6 @@ function collectConfiguredCssEntries(options) {
|
|
|
10033
10157
|
].filter((item) => typeof item === "string" && item.length > 0);
|
|
10034
10158
|
return entries.length > 0 ? [...new Set(entries)] : void 0;
|
|
10035
10159
|
}
|
|
10036
|
-
function normalizeViteStylePlatform(value, appType) {
|
|
10037
|
-
return normalizeFrameworkStylePlatform(value, appType);
|
|
10038
|
-
}
|
|
10039
10160
|
function inferPlatformFromOutDir(outDir) {
|
|
10040
10161
|
const segment = outDir ? path.basename(path.normalize(outDir)) : void 0;
|
|
10041
10162
|
if (!segment) return;
|
|
@@ -10084,10 +10205,10 @@ function createViteFrameworkPlugins$1(options = {}, frameworkBranch) {
|
|
|
10084
10205
|
const shouldRewriteCssImports = opts.rewriteCssImports === true;
|
|
10085
10206
|
let resolvedConfig;
|
|
10086
10207
|
const resolveViteStylePlatform = () => {
|
|
10087
|
-
const explicit =
|
|
10208
|
+
const explicit = normalizeFrameworkStylePlatform(opts.cssOptions?.platform ?? opts.platform, opts.appType);
|
|
10088
10209
|
if (explicit) return explicit;
|
|
10089
10210
|
for (const key of ENV_PLATFORM_KEYS) {
|
|
10090
|
-
const envPlatform =
|
|
10211
|
+
const envPlatform = normalizeFrameworkStylePlatform(process$1.env[key], opts.appType);
|
|
10091
10212
|
if (envPlatform) return envPlatform;
|
|
10092
10213
|
}
|
|
10093
10214
|
return inferPlatformFromOutDir(resolvedConfig?.build?.outDir);
|
|
@@ -10739,9 +10860,7 @@ ${tracedCss}`;
|
|
|
10739
10860
|
syncCssEntriesFromAnchor
|
|
10740
10861
|
});
|
|
10741
10862
|
const plugins = [
|
|
10742
|
-
...extraPlugins,
|
|
10743
|
-
...rewritePlugins,
|
|
10744
|
-
sourceCandidatesPlugin,
|
|
10863
|
+
...orderFrameworkSourceCandidatePlugins(extraPlugins, rewritePlugins, sourceCandidatesPlugin, frameworkBranch.sourceCandidatesBeforeExtraPlugin),
|
|
10745
10864
|
...createViteCssGenerationPlugins({
|
|
10746
10865
|
generateCss: generateTailwindCssForVitePipeline,
|
|
10747
10866
|
getCommand: () => resolvedConfig?.command,
|
|
@@ -11076,6 +11195,7 @@ function createUniAppXVitePlugins(options = {}) {
|
|
|
11076
11195
|
getExtraPluginPlatform: () => ({ isIosPlatform: resolveUniUtsPlatform().isAppIos }),
|
|
11077
11196
|
styleInjectorDelegate: viteStyleInjectorDelegates.uniApp,
|
|
11078
11197
|
isRuntimeClassSetFeatureEnabled: () => true,
|
|
11198
|
+
sourceCandidatesBeforeExtraPlugin: (plugin) => plugin.name === "weapp-tailwindcss:uni-app-x:nvue",
|
|
11079
11199
|
createExtraPlugins: (context) => createUniAppXPlugins({
|
|
11080
11200
|
appType: "uni-app-x",
|
|
11081
11201
|
customAttributesEntities: context.customAttributesEntities,
|