weapp-tailwindcss 5.0.4 → 5.0.6
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/{auto-BZ4n4Icc.js → auto-Cvy0zWpS.js} +1 -1
- package/dist/{bundle-state-D3RZHkXz.js → bundle-state-CFgzVHFP.js} +8 -2
- package/dist/{bundle-state-C-p9eFz1.mjs → bundle-state-CdNXQl-o.mjs} +2 -2
- package/dist/bundlers/shared/generator-css/directives.d.ts +1 -0
- package/dist/bundlers/vite/generate-bundle/css-handler-options.d.ts +1 -0
- package/dist/bundlers/vite/generate-bundle.d.ts +3 -1
- package/dist/bundlers/vite/rewrite-css-imports.d.ts +8 -0
- package/dist/bundlers/vite/serve-css-generation.d.ts +5 -0
- package/dist/bundlers/vite/uni-app-x-css-options.d.ts +2 -0
- package/dist/{chunk-D6vf50IK.js → chunk-emK7D4bc.js} +7 -0
- package/dist/core.js +1 -1
- package/dist/core.mjs +1 -1
- package/dist/css-macro.js +3 -3
- package/dist/{defaults-C5w9OOrj.js → defaults-BPUuNYcD.js} +1 -1
- package/dist/defaults.js +1 -1
- package/dist/{generator-DRHWC1t-.mjs → generator-Bgn4m8An.mjs} +1 -1
- package/dist/{generator-DaPOkJ7W.js → generator-C56PJYxA.js} +2 -2
- package/dist/generator.js +2 -2
- package/dist/generator.mjs +2 -2
- package/dist/gulp.js +6 -6
- package/dist/gulp.mjs +5 -5
- package/dist/{incremental-runtime-class-set-Dt-FUQB5.mjs → incremental-runtime-class-set-BEYHQkZc.mjs} +238 -44
- package/dist/{incremental-runtime-class-set-BYV0yQdp.js → incremental-runtime-class-set-Bmzdjlk0.js} +239 -45
- package/dist/index.js +4 -4
- package/dist/index.mjs +4 -4
- package/dist/{postcss-Du8hY-MN.js → postcss-B7QNe78h.js} +57 -10
- package/dist/{postcss-CJrmfXvi.mjs → postcss-BgINK7Nm.mjs} +55 -8
- package/dist/postcss-html-transform.js +1 -1
- package/dist/postcss.js +1 -1
- package/dist/postcss.mjs +1 -1
- package/dist/{precheck-lfenbOTF.mjs → precheck-Copn2SqE.mjs} +14 -3
- package/dist/{precheck-DgpVCvYk.js → precheck-CyPbGn38.js} +17 -6
- package/dist/presets.js +9 -5
- package/dist/presets.mjs +7 -3
- package/dist/reset.js +1 -1
- package/dist/{source-candidates-D7b-Jzsx.mjs → source-candidates-BODCmzz5.mjs} +1 -1
- package/dist/{source-candidates-B4NvId_j.js → source-candidates-Caf2GDvx.js} +2 -2
- package/dist/{tailwindcss-D5RogwtV.mjs → tailwindcss-C0Zgo3Es.mjs} +1 -1
- package/dist/{tailwindcss-26ZFr5kv.js → tailwindcss-Tw6CSVHL.js} +3 -3
- package/dist/transform-95ivJthq.js +14868 -0
- package/dist/transform-DgCFGtQR.mjs +14871 -0
- package/dist/uni-app-x/vite.d.ts +3 -0
- package/dist/{utils-nta4tfFs.js → utils-Dolmt8EO.js} +1 -1
- package/dist/{v3-engine-CBahpuIg.js → v3-engine-6FVAcrZl.js} +31 -6
- package/dist/{v3-engine-BCUGX3gX.mjs → v3-engine-Ji6AXPh2.mjs} +24 -5
- package/dist/{vite-tjYalmVX.js → vite-Bw6LOXvf.js} +733 -79
- package/dist/{vite-DS4H5d0f.mjs → vite-ChZ2cbn4.mjs} +745 -91
- package/dist/vite.js +1 -1
- package/dist/vite.mjs +1 -1
- package/dist/weapp-tw-css-import-rewrite-loader.js +247 -45
- package/dist/{webpack-CA-40WU9.mjs → webpack-CMJ7iqN7.mjs} +6 -6
- package/dist/{webpack-0BwLOE_f.js → webpack-nn3P8_S_.js} +8 -8
- package/dist/webpack.js +1 -1
- package/dist/webpack.mjs +1 -1
- package/package.json +3 -4
- package/dist/transform-Crn84vTL.js +0 -257
- package/dist/transform-FAxHXVZp.mjs +0 -255
package/dist/vite.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_vite = require("./vite-
|
|
2
|
+
const require_vite = require("./vite-Bw6LOXvf.js");
|
|
3
3
|
exports.WeappTailwindcss = require_vite.WeappTailwindcss;
|
|
4
4
|
exports.weappTailwindcss = require_vite.WeappTailwindcss;
|
package/dist/vite.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as WeappTailwindcss } from "./vite-
|
|
1
|
+
import { t as WeappTailwindcss } from "./vite-ChZ2cbn4.mjs";
|
|
2
2
|
export { WeappTailwindcss, WeappTailwindcss as weappTailwindcss };
|
|
@@ -97,6 +97,9 @@ function resolveUniAppXOptions(option) {
|
|
|
97
97
|
uvueUnsupported: "warn"
|
|
98
98
|
};
|
|
99
99
|
}
|
|
100
|
+
function isUniAppXEnabled(option) {
|
|
101
|
+
return resolveUniAppXOptions(option).enabled;
|
|
102
|
+
}
|
|
100
103
|
//#endregion
|
|
101
104
|
//#region src/context/style-options.ts
|
|
102
105
|
function resolveStyleOptionsFromContext(ctx) {
|
|
@@ -2361,7 +2364,7 @@ const TAILWIND_ROOT_DIRECTIVE_NAMES = new Set([
|
|
|
2361
2364
|
const TAILWIND_ROOT_DIRECTIVE_RE = /@(?:import\s+(?:url\(\s*)?["']?tailwindcss4?(?:\/[^"')\s]*)?|(?:use|forward)\s+(?:url\(\s*)?["']?tailwindcss4?(?:\/[^"')\s]*)?|tailwind|config|custom-variant|plugin|source|theme|utility|variant)\b/;
|
|
2362
2365
|
const TAILWIND_EXTRACTABLE_DIRECTIVE_RE = /^\s*@(?:import|use|forward|tailwind|config|source|reference|plugin)\b[\s\S]*?(?:;|$)/;
|
|
2363
2366
|
const TAILWIND_EXTRACTABLE_LAYER_STATEMENT_RE = /^\s*@layer\s[^;{]+;\s*$/;
|
|
2364
|
-
const TAILWIND_EXTRACTABLE_BLOCK_START_RE = /^\s*@(?:layer|theme|utility|variant|custom-variant)\b[\s\S]*\{/;
|
|
2367
|
+
const TAILWIND_EXTRACTABLE_BLOCK_START_RE = /^\s*@(?:layer|theme|utility|variant|custom-variant|plugin)\b[\s\S]*\{/;
|
|
2365
2368
|
const TAILWIND_V3_SUBPATH_IMPORT_LAYERS = new Map([
|
|
2366
2369
|
["tailwindcss/base", "base"],
|
|
2367
2370
|
["tailwindcss/components", "components"],
|
|
@@ -2434,6 +2437,7 @@ function extractTailwindDirectiveLines(rawSource, options = {}) {
|
|
|
2434
2437
|
if (!trimmed || trimmed.startsWith("//")) continue;
|
|
2435
2438
|
const directive = TAILWIND_EXTRACTABLE_DIRECTIVE_RE.exec(line)?.[0] ?? TAILWIND_EXTRACTABLE_LAYER_STATEMENT_RE.exec(line)?.[0];
|
|
2436
2439
|
if (!directive) continue;
|
|
2440
|
+
if (TAILWIND_EXTRACTABLE_BLOCK_START_RE.test(directive)) continue;
|
|
2437
2441
|
const normalized = normalizeTailwindDirectiveLine(directive.trimEnd(), options);
|
|
2438
2442
|
const normalizedTrimmed = normalized.trim();
|
|
2439
2443
|
if (options.removeConfig && normalizedTrimmed.startsWith("@config")) continue;
|
|
@@ -2776,7 +2780,10 @@ function resolveConfigDir(config, projectRoot) {
|
|
|
2776
2780
|
return node_path.default.dirname(configPath);
|
|
2777
2781
|
}
|
|
2778
2782
|
function isBarePackageSpecifier(specifier) {
|
|
2779
|
-
return !specifier.startsWith(".") && !specifier.startsWith("/") && !specifier.includes("\\") && !/^[a-z][a-z\d+.-]*:/i.test(specifier);
|
|
2783
|
+
return !specifier.startsWith(".") && !specifier.startsWith("/") && !specifier.startsWith("#") && !specifier.includes("\\") && !/^[a-z][a-z\d+.-]*:/i.test(specifier);
|
|
2784
|
+
}
|
|
2785
|
+
function isPackageJsonImportSpecifier(specifier) {
|
|
2786
|
+
return typeof specifier === "string" && specifier.startsWith("#");
|
|
2780
2787
|
}
|
|
2781
2788
|
function parseCssImportSpecifier$1(params) {
|
|
2782
2789
|
const value = params.trim();
|
|
@@ -2818,7 +2825,8 @@ function normalizeTailwindV4CssPackageImports(css, packageName) {
|
|
|
2818
2825
|
}
|
|
2819
2826
|
const importSpecifiers = createTailwindV4CssImportSpecifierSet(packageName);
|
|
2820
2827
|
let changed = false;
|
|
2821
|
-
root.walkAtRules(
|
|
2828
|
+
root.walkAtRules((rule) => {
|
|
2829
|
+
if (rule.name !== "import" && rule.name !== "reference") return;
|
|
2822
2830
|
const parsed = parseCssImportSpecifier$1(rule.params);
|
|
2823
2831
|
if (!parsed || !importSpecifiers.has(parsed.specifier)) return;
|
|
2824
2832
|
const cssEntryPoint = resolvePackageCssEntryPoint(`${parsed.specifier}/index.css`);
|
|
@@ -2855,7 +2863,8 @@ function normalizeTailwindV4CssEntrySources(cssEntries, packageName) {
|
|
|
2855
2863
|
}
|
|
2856
2864
|
const base = node_path.default.dirname(file);
|
|
2857
2865
|
const rawCss = (0, node_fs.readFileSync)(file, "utf8");
|
|
2858
|
-
const
|
|
2866
|
+
const entrySource = resolveCssEntrySource(rawCss, base, { removeConfig: false });
|
|
2867
|
+
const css = normalizeTailwindV4CssPackageImports(normalizeConfigDirective(rawCss, entrySource?.config && (0, node_fs.existsSync)(entrySource.config) ? entrySource.config : entrySource?.configRequest && !node_path.default.isAbsolute(entrySource.configRequest) && !isPackageJsonImportSpecifier(entrySource.configRequest) ? node_path.default.resolve(base, entrySource.configRequest) : entrySource?.config), packageName);
|
|
2859
2868
|
cssSources.push({
|
|
2860
2869
|
file,
|
|
2861
2870
|
base,
|
|
@@ -4540,7 +4549,10 @@ async function resolveTailwindV4CssEntrySource(cssEntry, sourceOptions) {
|
|
|
4540
4549
|
const css = (0, node_fs.readFileSync)(cssEntry, "utf8");
|
|
4541
4550
|
const base = node_path.default.dirname(node_path.default.resolve(cssEntry));
|
|
4542
4551
|
const entrySource = resolveCssEntrySource(css, base, { removeConfig: false });
|
|
4543
|
-
const config = resolveExistingConfigPath(entrySource?.config, entrySource?.configRequest, cssEntry,
|
|
4552
|
+
const config = resolveExistingConfigPath(entrySource?.config, entrySource?.configRequest, cssEntry, {
|
|
4553
|
+
...sourceOptions,
|
|
4554
|
+
sourceFile: sourceOptions.sourceFile ?? cssEntry
|
|
4555
|
+
});
|
|
4544
4556
|
return withGeneratorSourceMetadata(await resolveTailwindV4Source({
|
|
4545
4557
|
...omitUndefined(singleEntrySourceOptions),
|
|
4546
4558
|
base,
|
|
@@ -4838,7 +4850,7 @@ function withMatchedSourceSideMetadata(source, resolvedEntrySource) {
|
|
|
4838
4850
|
}
|
|
4839
4851
|
function createTailwindV4ApplyReferenceSource(css, sourceOptions) {
|
|
4840
4852
|
if (!hasTailwindApplyDirective(css) || hasTailwindRootDirectives(css)) return css;
|
|
4841
|
-
return `@
|
|
4853
|
+
return `@import "${sourceOptions.packageName ?? "tailwindcss"}" source(none);\n${css}`;
|
|
4842
4854
|
}
|
|
4843
4855
|
async function resolveGeneratorSource(majorVersion, runtimeState, rawSource, file, cssHandlerOptions, generatorOptions, selectionOptions) {
|
|
4844
4856
|
const base = resolveCssSourceBase(file, cssHandlerOptions);
|
|
@@ -4846,6 +4858,10 @@ async function resolveGeneratorSource(majorVersion, runtimeState, rawSource, fil
|
|
|
4846
4858
|
importFallback: generatorOptions?.importFallback ?? false,
|
|
4847
4859
|
removeConfig: majorVersion === 3
|
|
4848
4860
|
});
|
|
4861
|
+
const applyEntrySource = hasTailwindApplyDirective(rawSource) ? {
|
|
4862
|
+
base,
|
|
4863
|
+
css: rawSource
|
|
4864
|
+
} : void 0;
|
|
4849
4865
|
if (majorVersion === 3) {
|
|
4850
4866
|
const sourceOptions = resolveTailwindV3SourceOptionsFromPatcher(runtimeState.twPatcher);
|
|
4851
4867
|
const mergedSourceOptions = omitUndefined({
|
|
@@ -4856,10 +4872,6 @@ async function resolveGeneratorSource(majorVersion, runtimeState, rawSource, fil
|
|
|
4856
4872
|
cssEntries: selectionOptions?.cssEntries,
|
|
4857
4873
|
cssSources: createCssEntrySources(selectionOptions?.cssEntries)
|
|
4858
4874
|
});
|
|
4859
|
-
const applyEntrySource = hasTailwindApplyDirective(rawSource) ? {
|
|
4860
|
-
base,
|
|
4861
|
-
css: rawSource
|
|
4862
|
-
} : void 0;
|
|
4863
4875
|
const sourceSideEntrySource = canResolveSourceSideCssEntry(file, cssHandlerOptions, mergedSourceOptions) ? resolveSourceSideCssEntrySource(file, mergedSourceOptions, { removeConfig: true }) : void 0;
|
|
4864
4876
|
const shouldPreferSourceSideEntry = shouldPreferResolvedSourceSideEntry(cssEntrySource, sourceSideEntrySource);
|
|
4865
4877
|
const resolvedEntrySource = shouldResolveSourceSideCssEntry(rawSource) ? shouldPreferSourceSideEntry ? sourceSideEntrySource ?? cssEntrySource ?? applyEntrySource : cssEntrySource ?? applyEntrySource ?? sourceSideEntrySource : shouldPreferTailwindV3SourceSideEntry(rawSource, sourceSideEntrySource) || shouldPreferSourceSideEntry ? sourceSideEntrySource ?? cssEntrySource ?? applyEntrySource : cssEntrySource ?? applyEntrySource ?? sourceSideEntrySource;
|
|
@@ -4886,6 +4898,13 @@ async function resolveGeneratorSource(majorVersion, runtimeState, rawSource, fil
|
|
|
4886
4898
|
cssSources: mergeCssSources(sourceOptions.cssSources, sourceOptions.cssSources?.length ? void 0 : createCssEntrySources(selectionOptions?.cssEntries ?? sourceOptions.cssEntries))
|
|
4887
4899
|
}) : void 0;
|
|
4888
4900
|
const normalizedSourceOptions = resolvedSourceOptions ? normalizeTailwindV4CssSourceConfigs(resolvedSourceOptions) : void 0;
|
|
4901
|
+
if (applyEntrySource && !cssHandlerOptions.isMainChunk && !hasTailwindRootDirectives(rawSource, { importFallback: generatorOptions?.importFallback ?? false })) {
|
|
4902
|
+
const css = createTailwindV4ApplyReferenceSource(normalizeConfigDirective(prependConfigDirective(applyEntrySource.css, generatorOptions?.config), void 0), normalizedSourceOptions ?? {});
|
|
4903
|
+
return resolveTailwindV4Source(createSingleTailwindV4SourceOptions(normalizedSourceOptions ?? {}, {
|
|
4904
|
+
base: applyEntrySource.base,
|
|
4905
|
+
css
|
|
4906
|
+
}));
|
|
4907
|
+
}
|
|
4889
4908
|
const shouldPreferSourceSideEntry = shouldResolveSourceSideCssEntry(rawSource) || Boolean(cssEntrySource?.css.includes("weapp-tailwindcss generator-placeholder")) && (sourceOptions?.cssEntries?.length ?? 0) <= 1;
|
|
4890
4909
|
const sourceSideEntrySource = normalizedSourceOptions && shouldPreferSourceSideEntry && canResolveSourceSideCssEntry(file, cssHandlerOptions, normalizedSourceOptions) ? resolveSourceSideCssEntrySource(file, normalizedSourceOptions, { removeConfig: false }) : void 0;
|
|
4891
4910
|
const matchedCssEntrySource = normalizedSourceOptions ? await resolveMatchingTailwindV4CssEntry(rawSource, file, normalizedSourceOptions) : void 0;
|
|
@@ -4902,7 +4921,7 @@ async function resolveGeneratorSource(majorVersion, runtimeState, rawSource, fil
|
|
|
4902
4921
|
...preferredCssEntrySource,
|
|
4903
4922
|
css: prependConfigDirective(preferredCssEntrySource.css, generatorOptions.config)
|
|
4904
4923
|
} : preferredCssEntrySource;
|
|
4905
|
-
const resolvedEntrySource = sourceSideEntrySource ?? cssEntrySource;
|
|
4924
|
+
const resolvedEntrySource = sourceSideEntrySource ?? cssEntrySource ?? applyEntrySource;
|
|
4906
4925
|
if (!resolvedEntrySource) {
|
|
4907
4926
|
const source = await resolveTailwindV4SourceFromPatcher(runtimeState.twPatcher);
|
|
4908
4927
|
return generatorOptions?.config ? {
|
|
@@ -4924,7 +4943,7 @@ async function resolveGeneratorSources(majorVersion, runtimeState, rawSource, fi
|
|
|
4924
4943
|
importFallback: generatorOptions?.importFallback ?? false,
|
|
4925
4944
|
removeConfig: majorVersion === 3
|
|
4926
4945
|
});
|
|
4927
|
-
if (majorVersion !== 4 || cssEntrySource && !cssHandlerOptions.isMainChunk) {
|
|
4946
|
+
if (majorVersion !== 4 || cssEntrySource && !cssHandlerOptions.isMainChunk || !cssHandlerOptions.isMainChunk && hasTailwindApplyDirective(rawSource) && !hasTailwindRootDirectives(rawSource, { importFallback: generatorOptions?.importFallback ?? false })) {
|
|
4928
4947
|
const resolved = await resolveGeneratorSource(majorVersion, runtimeState, rawSource, file, cssHandlerOptions, generatorOptions, selectionOptions);
|
|
4929
4948
|
return resolved ? [resolved] : [];
|
|
4930
4949
|
}
|
|
@@ -5302,6 +5321,15 @@ function reorderMarkedUserLayerComponentsCss(css) {
|
|
|
5302
5321
|
//#region src/bundlers/shared/generator-css.ts
|
|
5303
5322
|
const SUPPORTED_GENERATOR_MAJOR_VERSIONS = new Set([3, 4]);
|
|
5304
5323
|
const REMOTE_IMPORT_RE = /^(?:https?:)?\/\//i;
|
|
5324
|
+
const TAILWIND_V4_GENERATOR_AT_RULES = new Set([
|
|
5325
|
+
"config",
|
|
5326
|
+
"custom-variant",
|
|
5327
|
+
"plugin",
|
|
5328
|
+
"source",
|
|
5329
|
+
"theme",
|
|
5330
|
+
"utility",
|
|
5331
|
+
"variant"
|
|
5332
|
+
]);
|
|
5305
5333
|
function finalizeMiniProgramGeneratorCss(css, target, majorVersion, cssPreflight, options = {}) {
|
|
5306
5334
|
if (target !== "weapp") return css;
|
|
5307
5335
|
return (0, _weapp_tailwindcss_postcss.finalizeMiniProgramCss)(css, {
|
|
@@ -5310,13 +5338,58 @@ function finalizeMiniProgramGeneratorCss(css, target, majorVersion, cssPreflight
|
|
|
5310
5338
|
preservePseudoContentInit: majorVersion === 3
|
|
5311
5339
|
});
|
|
5312
5340
|
}
|
|
5341
|
+
function shouldInjectMiniProgramPreflightForGeneratorCss(opts, options) {
|
|
5342
|
+
if (options.cssHandlerOptions.uniAppX === true && options.cssHandlerOptions.uniAppXCssTarget === "uvue") return false;
|
|
5343
|
+
if (!options.isolateCurrentCssCandidates) return true;
|
|
5344
|
+
return isUniAppXEnabled(opts.uniAppX) && Boolean(options.localImports?.trim());
|
|
5345
|
+
}
|
|
5313
5346
|
function mergeScopedRuntimeWithCurrentRuntime(scopedRuntime, runtime, options) {
|
|
5314
5347
|
if (options.isolateCssSource && options.currentCssCandidates?.length) return new Set([...scopedRuntime, ...options.currentCssCandidates]);
|
|
5315
5348
|
if (runtime.size === 0 || !options.cssHandlerOptions.isMainChunk || options.matchedCssSourceFile || options.isolateCssSource && scopedRuntime.size === 0) return scopedRuntime;
|
|
5316
5349
|
return new Set([...scopedRuntime, ...runtime]);
|
|
5317
5350
|
}
|
|
5318
5351
|
function shouldIsolateScopedCssSource(source, sourceEntries) {
|
|
5319
|
-
return
|
|
5352
|
+
return Boolean(source.__weappTailwindcssMeta?.matchedCssSourceFile) || sourceEntries !== void 0 && sourceEntries.length > 0;
|
|
5353
|
+
}
|
|
5354
|
+
function shouldIsolateCurrentTailwindV4CssCandidates(majorVersion, cssHandlerOptions, options) {
|
|
5355
|
+
return majorVersion === 4 && !cssHandlerOptions.isMainChunk && hasTailwindApplyDirective(options.rawSource) && !hasTailwindRootDirectives(options.rawSource) && !options.hasGeneratedCss && !options.hasGeneratedMarkers;
|
|
5356
|
+
}
|
|
5357
|
+
function removeTailwindApplyAtRules(source) {
|
|
5358
|
+
if (!source.includes("@apply")) return source;
|
|
5359
|
+
try {
|
|
5360
|
+
const root = require_watch_dependencies.postcss_default.parse(source);
|
|
5361
|
+
let changed = false;
|
|
5362
|
+
root.walkAtRules("apply", (rule) => {
|
|
5363
|
+
rule.remove();
|
|
5364
|
+
changed = true;
|
|
5365
|
+
});
|
|
5366
|
+
root.walk((node) => {
|
|
5367
|
+
if ("nodes" in node && node.nodes?.length === 0) node.remove();
|
|
5368
|
+
});
|
|
5369
|
+
return changed ? root.toString() : source;
|
|
5370
|
+
} catch {
|
|
5371
|
+
return source;
|
|
5372
|
+
}
|
|
5373
|
+
}
|
|
5374
|
+
function removeTailwindV4GeneratorAtRules(source) {
|
|
5375
|
+
try {
|
|
5376
|
+
const root = require_watch_dependencies.postcss_default.parse(source);
|
|
5377
|
+
let changed = false;
|
|
5378
|
+
root.walkAtRules((rule) => {
|
|
5379
|
+
if (!TAILWIND_V4_GENERATOR_AT_RULES.has(rule.name)) return;
|
|
5380
|
+
rule.remove();
|
|
5381
|
+
changed = true;
|
|
5382
|
+
});
|
|
5383
|
+
root.walk((node) => {
|
|
5384
|
+
if ("nodes" in node && node.nodes?.length === 0) {
|
|
5385
|
+
node.remove();
|
|
5386
|
+
changed = true;
|
|
5387
|
+
}
|
|
5388
|
+
});
|
|
5389
|
+
return changed ? root.toString() : source;
|
|
5390
|
+
} catch {
|
|
5391
|
+
return source;
|
|
5392
|
+
}
|
|
5320
5393
|
}
|
|
5321
5394
|
function shouldScanTailwindV4Sources(majorVersion, target, generatorRuntime, isolateCssSource) {
|
|
5322
5395
|
if (majorVersion !== 4 || isolateCssSource) return false;
|
|
@@ -5344,7 +5417,7 @@ function resolveGeneratorStyleOptions(opts, cssHandlerOptions, generatorStyleOpt
|
|
|
5344
5417
|
};
|
|
5345
5418
|
}
|
|
5346
5419
|
function isLocalImportRequest(request) {
|
|
5347
|
-
return request.length > 0 && !request.startsWith("tailwindcss") && !request.startsWith("weapp-tailwindcss") && !request.startsWith("data:") && !REMOTE_IMPORT_RE.test(request);
|
|
5420
|
+
return request.length > 0 && !request.startsWith("#") && !request.startsWith("tailwindcss") && !request.startsWith("weapp-tailwindcss") && !request.startsWith("data:") && !REMOTE_IMPORT_RE.test(request);
|
|
5348
5421
|
}
|
|
5349
5422
|
function isCommentOnlyCss(source) {
|
|
5350
5423
|
try {
|
|
@@ -5355,7 +5428,19 @@ function isCommentOnlyCss(source) {
|
|
|
5355
5428
|
}
|
|
5356
5429
|
}
|
|
5357
5430
|
function stripTailwindSourceMediaFragments(source) {
|
|
5358
|
-
|
|
5431
|
+
let removedSourceMediaStart = false;
|
|
5432
|
+
return source.split(/\r?\n/).filter((line) => {
|
|
5433
|
+
if (/^\s*@media\s+source\([^)]*\)\s*\{\s*$/.test(line)) {
|
|
5434
|
+
removedSourceMediaStart = true;
|
|
5435
|
+
return false;
|
|
5436
|
+
}
|
|
5437
|
+
if (/^\s*\}\s*\/\*\s*source\([^)]*\)\s*\*\/\s*$/.test(line)) return false;
|
|
5438
|
+
if (removedSourceMediaStart && /^\s*\}\s*$/.test(line)) {
|
|
5439
|
+
removedSourceMediaStart = false;
|
|
5440
|
+
return false;
|
|
5441
|
+
}
|
|
5442
|
+
return true;
|
|
5443
|
+
}).join("\n").replace(/\}[^\S\r\n]*(?=@(?:config|source)\b)/g, "");
|
|
5359
5444
|
}
|
|
5360
5445
|
function stripLeadingTailwindSourceMediaCloseFragment(source) {
|
|
5361
5446
|
return source.replace(/^\s*\}\s*(?:\n|$)/, "");
|
|
@@ -5462,11 +5547,70 @@ function extractGeneratedCssForUserLayerSelectors(css, userLayerSource) {
|
|
|
5462
5547
|
};
|
|
5463
5548
|
}
|
|
5464
5549
|
}
|
|
5550
|
+
function normalizeGeneratedSelector(selector) {
|
|
5551
|
+
return selector.replace(/:not\(#\\#\)/g, "").trim();
|
|
5552
|
+
}
|
|
5553
|
+
function collectApplyOnlySourceSelectors(source) {
|
|
5554
|
+
const selectors = /* @__PURE__ */ new Set();
|
|
5555
|
+
try {
|
|
5556
|
+
require_watch_dependencies.postcss_default.parse(source).walkRules((rule) => {
|
|
5557
|
+
if (!rule.nodes?.some((node) => node.type === "atrule" && node.name === "apply")) return;
|
|
5558
|
+
for (const selector of rule.selectors ?? [rule.selector]) {
|
|
5559
|
+
const normalized = normalizeGeneratedSelector(selector);
|
|
5560
|
+
if (normalized) selectors.add(normalized);
|
|
5561
|
+
}
|
|
5562
|
+
});
|
|
5563
|
+
} catch {}
|
|
5564
|
+
return selectors;
|
|
5565
|
+
}
|
|
5566
|
+
function hasOnlyApplyBackedSourceRules(source) {
|
|
5567
|
+
let hasApplyRule = false;
|
|
5568
|
+
let hasNonApplyRule = false;
|
|
5569
|
+
try {
|
|
5570
|
+
require_watch_dependencies.postcss_default.parse(source).walkRules((rule) => {
|
|
5571
|
+
if (rule.nodes?.some((node) => node.type === "atrule" && node.name === "apply")) hasApplyRule = true;
|
|
5572
|
+
else hasNonApplyRule = true;
|
|
5573
|
+
});
|
|
5574
|
+
} catch {
|
|
5575
|
+
return false;
|
|
5576
|
+
}
|
|
5577
|
+
return hasApplyRule && !hasNonApplyRule;
|
|
5578
|
+
}
|
|
5579
|
+
function filterApplyOnlyGeneratedCss(css, source) {
|
|
5580
|
+
const selectors = collectApplyOnlySourceSelectors(source);
|
|
5581
|
+
if (selectors.size === 0) return css;
|
|
5582
|
+
const selectorList = [...selectors];
|
|
5583
|
+
try {
|
|
5584
|
+
const root = require_watch_dependencies.postcss_default.parse(css);
|
|
5585
|
+
root.walkRules((rule) => {
|
|
5586
|
+
const isApplySelector = (rule.selectors ?? [rule.selector]).some((selector) => {
|
|
5587
|
+
const normalized = normalizeGeneratedSelector(selector);
|
|
5588
|
+
return selectorList.some((sourceSelector) => {
|
|
5589
|
+
if (normalized === sourceSelector) return true;
|
|
5590
|
+
if (!normalized.startsWith(sourceSelector)) return false;
|
|
5591
|
+
const next = normalized[sourceSelector.length];
|
|
5592
|
+
return next === ":" || next === "[" || next === ".";
|
|
5593
|
+
});
|
|
5594
|
+
});
|
|
5595
|
+
const isVariableRule = rule.nodes?.some((node) => node.type === "decl" && node.prop.startsWith("--"));
|
|
5596
|
+
if (!isApplySelector && !isVariableRule) rule.remove();
|
|
5597
|
+
});
|
|
5598
|
+
root.walkAtRules((rule) => {
|
|
5599
|
+
if (rule.nodes !== void 0 && rule.nodes.length === 0) rule.remove();
|
|
5600
|
+
});
|
|
5601
|
+
return root.toString();
|
|
5602
|
+
} catch {
|
|
5603
|
+
return css;
|
|
5604
|
+
}
|
|
5605
|
+
}
|
|
5606
|
+
function shouldFilterApplyOnlyGeneratedCss(majorVersion, target, source, options) {
|
|
5607
|
+
return majorVersion === 4 && target === "weapp" && hasTailwindApplyDirective(source) && !hasTailwindRootDirectives(source) && !options.hasGeneratedCss && !options.hasGeneratedMarkers && collectApplyOnlySourceSelectors(source).size > 0 && hasOnlyApplyBackedSourceRules(source);
|
|
5608
|
+
}
|
|
5465
5609
|
async function transformGeneratorUserCss(source, options) {
|
|
5466
5610
|
if (source.trim().length === 0) return "";
|
|
5467
|
-
const cleanedSource = removeTailwindSourceDirectives(stripUnmatchedTailwindSourceMediaCloseFragments(stripTailwindSourceMediaFragments(source)), { importFallback: options.importFallback });
|
|
5611
|
+
const cleanedSource = removeTailwindSourceDirectives(removeTailwindV4GeneratorAtRules(stripUnmatchedTailwindSourceMediaCloseFragments(stripTailwindSourceMediaFragments(source))), { importFallback: options.importFallback });
|
|
5468
5612
|
if (cleanedSource.trim().length === 0) return "";
|
|
5469
|
-
const userSource = stripUnmatchedTailwindSourceMediaCloseFragments(removeTailwindSourceDirectives(stripUnmatchedTailwindSourceMediaCloseFragments(stripTailwindSourceMediaFragments(options.generatorTarget === "weapp" ? (0, _weapp_tailwindcss_postcss.removeUnsupportedMiniProgramAtRules)(cleanedSource) : cleanedSource)), { importFallback: options.importFallback }));
|
|
5613
|
+
const userSource = stripUnmatchedTailwindSourceMediaCloseFragments(removeTailwindApplyAtRules(removeTailwindSourceDirectives(stripUnmatchedTailwindSourceMediaCloseFragments(stripTailwindSourceMediaFragments(options.generatorTarget === "weapp" ? (0, _weapp_tailwindcss_postcss.removeUnsupportedMiniProgramAtRules)(cleanedSource) : cleanedSource)), { importFallback: options.importFallback })));
|
|
5470
5614
|
if (userSource.trim().length === 0) return "";
|
|
5471
5615
|
if (isCommentOnlyCss(userSource)) return userSource;
|
|
5472
5616
|
if (options.generatorTarget !== "weapp") return userSource;
|
|
@@ -5528,6 +5672,32 @@ function prefixLocalCssImportsWithWebpackIgnore(css) {
|
|
|
5528
5672
|
return css;
|
|
5529
5673
|
}
|
|
5530
5674
|
}
|
|
5675
|
+
function splitLocalCssImports(source) {
|
|
5676
|
+
try {
|
|
5677
|
+
const root = require_watch_dependencies.postcss_default.parse(source);
|
|
5678
|
+
const importRoot = require_watch_dependencies.postcss_default.root();
|
|
5679
|
+
let changed = false;
|
|
5680
|
+
for (const node of [...root.nodes]) {
|
|
5681
|
+
if (node.type !== "atrule" || node.name !== "import") continue;
|
|
5682
|
+
const request = parseImportRequest(node.params);
|
|
5683
|
+
if (!request || !isLocalImportRequest(request)) continue;
|
|
5684
|
+
importRoot.append(node.clone());
|
|
5685
|
+
node.remove();
|
|
5686
|
+
changed = true;
|
|
5687
|
+
}
|
|
5688
|
+
const imports = importRoot.nodes.filter((node) => node.type === "atrule" && node.name === "import").map((node) => `@import ${node.params};`).join("\n");
|
|
5689
|
+
return changed ? {
|
|
5690
|
+
imports,
|
|
5691
|
+
source: root.toString()
|
|
5692
|
+
} : void 0;
|
|
5693
|
+
} catch {
|
|
5694
|
+
return;
|
|
5695
|
+
}
|
|
5696
|
+
}
|
|
5697
|
+
function restoreLocalCssImports(css, imports) {
|
|
5698
|
+
if (!imports?.trim()) return css;
|
|
5699
|
+
return createCssSourceOrderAppend(imports, css);
|
|
5700
|
+
}
|
|
5531
5701
|
async function generateCssByGenerator(options) {
|
|
5532
5702
|
const { opts, runtimeState, runtime, rawSource, file, cssHandlerOptions, cssUserHandlerOptions, getSourceCandidatesForEntries, styleHandler, debug } = options;
|
|
5533
5703
|
const generatorOptions = {
|
|
@@ -5536,6 +5706,9 @@ async function generateCssByGenerator(options) {
|
|
|
5536
5706
|
};
|
|
5537
5707
|
const majorVersion = runtimeState.twPatcher.majorVersion;
|
|
5538
5708
|
const effectiveRawSource = stripUnmatchedTailwindSourceMediaCloseFragments(stripTailwindSourceMediaFragments(normalizeTailwindSourceDirectives(rawSource, { importFallback: generatorOptions.importFallback })));
|
|
5709
|
+
const localImportParts = splitLocalCssImports(effectiveRawSource);
|
|
5710
|
+
const generatorRawSource = localImportParts?.source ?? effectiveRawSource;
|
|
5711
|
+
const userCssRawSource = majorVersion === 4 ? removeTailwindV4GeneratorAtRules(generatorRawSource) : generatorRawSource;
|
|
5539
5712
|
const cleanedLocalImportWrapper = cleanLocalCssImportWrapperTailwindDirectives(effectiveRawSource);
|
|
5540
5713
|
if (cleanedLocalImportWrapper !== void 0) return {
|
|
5541
5714
|
css: generatorOptions.target === "weapp" ? (0, _weapp_tailwindcss_postcss.removeUnsupportedMiniProgramAtRules)(cleanedLocalImportWrapper) : cleanedLocalImportWrapper,
|
|
@@ -5544,16 +5717,21 @@ async function generateCssByGenerator(options) {
|
|
|
5544
5717
|
dependencies: []
|
|
5545
5718
|
};
|
|
5546
5719
|
if (isPureLocalCssImportWrapper(effectiveRawSource)) return;
|
|
5547
|
-
const hasGeneratedCss = hasTailwindGeneratedCss(
|
|
5548
|
-
const hasSourceDirectives = hasTailwindSourceDirectives(
|
|
5549
|
-
const hasGeneratedMarkers = hasTailwindGeneratedCssMarkers(
|
|
5720
|
+
const hasGeneratedCss = hasTailwindGeneratedCss(generatorRawSource);
|
|
5721
|
+
const hasSourceDirectives = hasTailwindSourceDirectives(generatorRawSource, { importFallback: generatorOptions.importFallback });
|
|
5722
|
+
const hasGeneratedMarkers = hasTailwindGeneratedCssMarkers(generatorRawSource);
|
|
5550
5723
|
const shouldGenerateCurrentCss = hasGeneratedCss || hasGeneratedMarkers || hasSourceDirectives || cssHandlerOptions.isMainChunk;
|
|
5551
5724
|
if (!SUPPORTED_GENERATOR_MAJOR_VERSIONS.has(majorVersion ?? 0) || !shouldGenerateCurrentCss || majorVersion === 3 && !hasSourceDirectives && !hasGeneratedCss && !hasGeneratedMarkers) return;
|
|
5552
5725
|
try {
|
|
5553
5726
|
await runtimeState.readyPromise;
|
|
5554
|
-
const currentCssCandidates = majorVersion === 4 ? await (0, tailwindcss_patch.extractSourceCandidates)(
|
|
5555
|
-
const
|
|
5556
|
-
|
|
5727
|
+
const currentCssCandidates = majorVersion === 4 ? await (0, tailwindcss_patch.extractSourceCandidates)(generatorRawSource, "css", { ...generatorOptions.bareArbitraryValues === void 0 ? {} : { bareArbitraryValues: generatorOptions.bareArbitraryValues } }) : [];
|
|
5728
|
+
const isolateCurrentCssCandidates = shouldIsolateCurrentTailwindV4CssCandidates(majorVersion, cssHandlerOptions, {
|
|
5729
|
+
hasGeneratedCss,
|
|
5730
|
+
hasGeneratedMarkers,
|
|
5731
|
+
rawSource: generatorRawSource
|
|
5732
|
+
});
|
|
5733
|
+
const runtimeWithCurrentCss = isolateCurrentCssCandidates ? new Set(currentCssCandidates) : currentCssCandidates.length > 0 ? new Set([...runtime, ...currentCssCandidates]) : runtime;
|
|
5734
|
+
const sources = await resolveGeneratorSources(majorVersion, runtimeState, generatorRawSource, file, cssHandlerOptions, generatorOptions, {
|
|
5557
5735
|
cssEntries: opts.cssEntries,
|
|
5558
5736
|
getSourceCandidatesForEntries,
|
|
5559
5737
|
runtime: runtimeWithCurrentCss
|
|
@@ -5570,17 +5748,18 @@ async function generateCssByGenerator(options) {
|
|
|
5570
5748
|
debug("defer empty scoped css source generation: %s", file);
|
|
5571
5749
|
return;
|
|
5572
5750
|
}
|
|
5573
|
-
const sourceRuntime = scopedRuntime && (scopedRuntime.size > 0 || isolateCssSource) ? mergeScopedRuntimeWithCurrentRuntime(scopedRuntime, runtimeWithCurrentCss, {
|
|
5751
|
+
const sourceRuntime = scopedRuntime && (scopedRuntime.size > 0 || isolateCssSource) ? isolateCurrentCssCandidates ? runtimeWithCurrentCss : mergeScopedRuntimeWithCurrentRuntime(scopedRuntime, runtimeWithCurrentCss, {
|
|
5574
5752
|
currentCssCandidates,
|
|
5575
5753
|
cssHandlerOptions,
|
|
5576
5754
|
isolateCssSource,
|
|
5577
5755
|
matchedCssSourceFile
|
|
5578
5756
|
}) : runtimeWithCurrentCss;
|
|
5579
5757
|
const generatorRuntime = majorVersion === 4 && generatorOptions.target === "weapp" ? filterUnsupportedMiniProgramTailwindV4Candidates(sourceRuntime) : sourceRuntime;
|
|
5758
|
+
const useIncrementalCache = (majorVersion === 3 || majorVersion === 4) && !(majorVersion === 3 && isolateCssSource);
|
|
5580
5759
|
return generator.generate({
|
|
5581
5760
|
bareArbitraryValues: generatorOptions.bareArbitraryValues,
|
|
5582
5761
|
candidates: generatorRuntime,
|
|
5583
|
-
incrementalCache:
|
|
5762
|
+
incrementalCache: useIncrementalCache,
|
|
5584
5763
|
scanSources: shouldScanTailwindV4Sources(majorVersion, generatorOptions.target, generatorRuntime, isolateCssSource),
|
|
5585
5764
|
styleOptions: generatorStyleOptions,
|
|
5586
5765
|
tailwindcssV3Compatibility: generatorOptions.tailwindcssV3Compatibility,
|
|
@@ -5602,22 +5781,27 @@ async function generateCssByGenerator(options) {
|
|
|
5602
5781
|
sources: generatedResults.flatMap((item) => item.sources)
|
|
5603
5782
|
};
|
|
5604
5783
|
debug("tailwind generator result: %s rawBytes=%d cssBytes=%d candidates=%d", file, generated.rawCss.length, generated.css.length, generated.classSet.size);
|
|
5605
|
-
if ((generated.target !== "weapp" || !hasUserCssLayerBlocks(
|
|
5784
|
+
if ((generated.target !== "weapp" || !hasUserCssLayerBlocks(generatorRawSource)) && typeof options.previousCss === "string" && typeof generated.incrementalCss === "string") {
|
|
5606
5785
|
const incrementalCss = stripTailwindBanner(generated.incrementalCss);
|
|
5607
5786
|
return {
|
|
5608
|
-
css: incrementalCss.trim().length > 0 ? createCssAppend(options.previousCss, finalizeMiniProgramGeneratorCss(incrementalCss, generated.target, majorVersion, opts.cssPreflight, { injectPreflight: false })) : options.previousCss,
|
|
5787
|
+
css: restoreLocalCssImports(incrementalCss.trim().length > 0 ? createCssAppend(options.previousCss, finalizeMiniProgramGeneratorCss(incrementalCss, generated.target, majorVersion, opts.cssPreflight, { injectPreflight: false })) : options.previousCss, localImportParts?.imports),
|
|
5609
5788
|
target: generated.target,
|
|
5610
5789
|
source: "generator",
|
|
5611
5790
|
dependencies: generated.dependencies,
|
|
5612
5791
|
incremental: true
|
|
5613
5792
|
};
|
|
5614
5793
|
}
|
|
5794
|
+
const shouldFilterApplyOnlyCss = shouldFilterApplyOnlyGeneratedCss(majorVersion, generated.target, generatorRawSource, {
|
|
5795
|
+
hasGeneratedCss,
|
|
5796
|
+
hasGeneratedMarkers
|
|
5797
|
+
});
|
|
5798
|
+
const generatedCss = shouldFilterApplyOnlyCss ? filterApplyOnlyGeneratedCss(stripTailwindBanner(generated.css), generatorRawSource) : stripTailwindBanner(generated.css);
|
|
5615
5799
|
const hasMatchedCssSourceFile = sources.some((source) => source.__weappTailwindcssMeta?.matchedCssSourceFile);
|
|
5616
|
-
const orderedExtraCss = hasMatchedCssSourceFile ? splitTailwindV4GeneratedCssBySourceOrder(
|
|
5800
|
+
const orderedExtraCss = hasMatchedCssSourceFile ? splitTailwindV4GeneratedCssBySourceOrder(userCssRawSource, generated.rawCss) : splitRawSourceByGeneratedCssOrder(userCssRawSource, generated.rawCss);
|
|
5617
5801
|
const shouldAppendMatchedCssSourceCompat = !hasMatchedCssSourceFile || orderedExtraCss !== void 0;
|
|
5618
5802
|
if (orderedExtraCss) {
|
|
5619
|
-
let css =
|
|
5620
|
-
if (generated.target === "weapp") css = inheritLegacyUnitConvertedDeclarations(css,
|
|
5803
|
+
let css = generatedCss;
|
|
5804
|
+
if (generated.target === "weapp") css = inheritLegacyUnitConvertedDeclarations(css, generatorRawSource);
|
|
5621
5805
|
const userCssOptions = {
|
|
5622
5806
|
generatorTarget: generated.target,
|
|
5623
5807
|
generatorStyleOptions,
|
|
@@ -5637,27 +5821,33 @@ async function generateCssByGenerator(options) {
|
|
|
5637
5821
|
hasSourceDirectives,
|
|
5638
5822
|
hasMatchedCssSourceFile
|
|
5639
5823
|
})) {
|
|
5640
|
-
const userCss = await transformGeneratorUserCss(
|
|
5824
|
+
const userCss = await transformGeneratorUserCss(userCssRawSource, userCssOptions);
|
|
5641
5825
|
css = createCssSourceOrderAppend(css, userCss);
|
|
5642
5826
|
}
|
|
5643
5827
|
if (generated.target === "weapp" && shouldAppendMatchedCssSourceCompat) {
|
|
5644
5828
|
if (shouldFinalizeMarkedUserLayerComponentsCss(file)) css = reorderMarkedUserLayerComponentsCss(css);
|
|
5645
|
-
|
|
5646
|
-
|
|
5829
|
+
if (!shouldFilterApplyOnlyCss) {
|
|
5830
|
+
css = await appendLegacyCompatCss(css, userCssRawSource, generated.target, styleHandler, cssHandlerOptions, generatorStyleOptions);
|
|
5831
|
+
if (!isolateCurrentCssCandidates) css = await appendLegacyContainerCompatCss(css, userCssRawSource, file, runtime, configuredContainerCompat, generated.target, styleHandler, cssHandlerOptions, generatorStyleOptions);
|
|
5832
|
+
}
|
|
5647
5833
|
} else if (generated.target === "weapp" && shouldFinalizeMarkedUserLayerComponentsCss(file)) css = reorderMarkedUserLayerComponentsCss(css);
|
|
5648
5834
|
return {
|
|
5649
|
-
css: finalizeMiniProgramGeneratorCss(css, generated.target, majorVersion, opts.cssPreflight
|
|
5835
|
+
css: restoreLocalCssImports(finalizeMiniProgramGeneratorCss(css, generated.target, majorVersion, opts.cssPreflight, { injectPreflight: shouldInjectMiniProgramPreflightForGeneratorCss(opts, {
|
|
5836
|
+
cssHandlerOptions,
|
|
5837
|
+
isolateCurrentCssCandidates,
|
|
5838
|
+
localImports: localImportParts?.imports
|
|
5839
|
+
}) }), localImportParts?.imports),
|
|
5650
5840
|
target: generated.target,
|
|
5651
5841
|
source: "generator",
|
|
5652
5842
|
dependencies: generated.dependencies
|
|
5653
5843
|
};
|
|
5654
5844
|
}
|
|
5655
5845
|
debug("tailwind direct css generation prefix mismatch, append transformed bundle css %s", file);
|
|
5656
|
-
let css =
|
|
5846
|
+
let css = generatedCss;
|
|
5657
5847
|
if (generated.target === "weapp") {
|
|
5658
|
-
css = inheritLegacyUnitConvertedDeclarations(css,
|
|
5659
|
-
if (hasUserCssLayerBlocks(
|
|
5660
|
-
const layerParts = splitUserCssLayerBlocks(
|
|
5848
|
+
css = inheritLegacyUnitConvertedDeclarations(css, generatorRawSource);
|
|
5849
|
+
if (hasUserCssLayerBlocks(generatorRawSource)) {
|
|
5850
|
+
const layerParts = splitUserCssLayerBlocks(generatorRawSource);
|
|
5661
5851
|
const layerUserCss = await transformGeneratorUserCss(layerParts.layer, {
|
|
5662
5852
|
generatorTarget: generated.target,
|
|
5663
5853
|
generatorStyleOptions,
|
|
@@ -5677,7 +5867,7 @@ async function generateCssByGenerator(options) {
|
|
|
5677
5867
|
}
|
|
5678
5868
|
if (hasMatchedCssSourceFile || generated.target === "web") {
|
|
5679
5869
|
if (hasMatchedCssSourceFile && generated.target === "weapp" && !hasGeneratedCss && !hasGeneratedMarkers) {
|
|
5680
|
-
const userCss = await transformGeneratorUserCss(
|
|
5870
|
+
const userCss = await transformGeneratorUserCss(userCssRawSource, {
|
|
5681
5871
|
generatorTarget: generated.target,
|
|
5682
5872
|
generatorStyleOptions,
|
|
5683
5873
|
cssUserHandlerOptions,
|
|
@@ -5686,12 +5876,14 @@ async function generateCssByGenerator(options) {
|
|
|
5686
5876
|
});
|
|
5687
5877
|
css = createCssSourceOrderAppend(css, userCss);
|
|
5688
5878
|
}
|
|
5689
|
-
if (hasMatchedCssSourceFile && generated.target === "weapp")
|
|
5879
|
+
if (hasMatchedCssSourceFile && generated.target === "weapp") {
|
|
5880
|
+
if (!isolateCurrentCssCandidates && !shouldFilterApplyOnlyCss) css = await appendLegacyContainerCompatCss(css, userCssRawSource, file, runtime, configuredContainerCompat, generated.target, styleHandler, cssHandlerOptions, generatorStyleOptions);
|
|
5881
|
+
}
|
|
5690
5882
|
if (shouldAppendWebBundleCssFallback(generated.target, {
|
|
5691
5883
|
hasSourceDirectives,
|
|
5692
5884
|
hasMatchedCssSourceFile
|
|
5693
5885
|
})) {
|
|
5694
|
-
const userCss = await transformGeneratorUserCss(
|
|
5886
|
+
const userCss = await transformGeneratorUserCss(userCssRawSource, {
|
|
5695
5887
|
generatorTarget: generated.target,
|
|
5696
5888
|
generatorStyleOptions,
|
|
5697
5889
|
cssUserHandlerOptions,
|
|
@@ -5701,16 +5893,26 @@ async function generateCssByGenerator(options) {
|
|
|
5701
5893
|
css = createCssSourceOrderAppend(css, userCss);
|
|
5702
5894
|
}
|
|
5703
5895
|
return {
|
|
5704
|
-
css: finalizeMiniProgramGeneratorCss(css, generated.target, majorVersion, opts.cssPreflight
|
|
5896
|
+
css: restoreLocalCssImports(finalizeMiniProgramGeneratorCss(css, generated.target, majorVersion, opts.cssPreflight, { injectPreflight: shouldInjectMiniProgramPreflightForGeneratorCss(opts, {
|
|
5897
|
+
cssHandlerOptions,
|
|
5898
|
+
isolateCurrentCssCandidates,
|
|
5899
|
+
localImports: localImportParts?.imports
|
|
5900
|
+
}) }), localImportParts?.imports),
|
|
5705
5901
|
target: generated.target,
|
|
5706
5902
|
source: "generator",
|
|
5707
5903
|
dependencies: generated.dependencies
|
|
5708
5904
|
};
|
|
5709
5905
|
}
|
|
5710
|
-
|
|
5711
|
-
|
|
5906
|
+
if (!shouldFilterApplyOnlyCss) {
|
|
5907
|
+
css = await appendLegacyCompatCss(css, userCssRawSource, generated.target, styleHandler, cssHandlerOptions, generatorStyleOptions);
|
|
5908
|
+
css = await appendLegacyContainerCompatCss(css, userCssRawSource, file, runtime, configuredContainerCompat, generated.target, styleHandler, cssHandlerOptions, generatorStyleOptions);
|
|
5909
|
+
}
|
|
5712
5910
|
return {
|
|
5713
|
-
css: finalizeMiniProgramGeneratorCss(css, generated.target, majorVersion, opts.cssPreflight
|
|
5911
|
+
css: restoreLocalCssImports(finalizeMiniProgramGeneratorCss(css, generated.target, majorVersion, opts.cssPreflight, { injectPreflight: shouldInjectMiniProgramPreflightForGeneratorCss(opts, {
|
|
5912
|
+
cssHandlerOptions,
|
|
5913
|
+
isolateCurrentCssCandidates,
|
|
5914
|
+
localImports: localImportParts?.imports
|
|
5915
|
+
}) }), localImportParts?.imports),
|
|
5714
5916
|
target: generated.target,
|
|
5715
5917
|
source: "generator",
|
|
5716
5918
|
dependencies: generated.dependencies
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { i as normalizeWeappTailwindcssGeneratorOptions } from "./generator-
|
|
3
|
-
import { b as refreshTailwindRuntimeState, d as _defineProperty, i as pluginName, n as getCompilerContext, t as shouldSkipJsTransform, v as createTailwindRuntimeReadyPromise, y as ensureRuntimeClassSet } from "./precheck-
|
|
1
|
+
import { M as removeTailwindSourceDirectives, l as getRuntimeClassSetSignature, lt as createDebug, pt as resolveTailwindcssOptions } from "./v3-engine-Ji6AXPh2.mjs";
|
|
2
|
+
import { i as normalizeWeappTailwindcssGeneratorOptions } from "./generator-Bgn4m8An.mjs";
|
|
3
|
+
import { b as refreshTailwindRuntimeState, d as _defineProperty, i as pluginName, n as getCompilerContext, t as shouldSkipJsTransform, v as createTailwindRuntimeReadyPromise, y as ensureRuntimeClassSet } from "./precheck-Copn2SqE.mjs";
|
|
4
4
|
import { r as getGroupedEntries } from "./utils-DsaS975I.mjs";
|
|
5
|
-
import { c as hasConfiguredTailwindV4CssRoots, l as upsertTailwindV4CssSource } from "./tailwindcss-
|
|
6
|
-
import { i as generateCssByGenerator, r as emitHmrTiming, s as processCachedTask, t as createBundleRuntimeClassSetManager } from "./incremental-runtime-class-set-
|
|
7
|
-
import {
|
|
5
|
+
import { c as hasConfiguredTailwindV4CssRoots, l as upsertTailwindV4CssSource } from "./tailwindcss-C0Zgo3Es.mjs";
|
|
6
|
+
import { i as generateCssByGenerator, r as emitHmrTiming, s as processCachedTask, t as createBundleRuntimeClassSetManager } from "./incremental-runtime-class-set-BEYHQkZc.mjs";
|
|
7
|
+
import { C as toAbsoluteOutputPath, S as resolveOutputSpecifier, b as stripRequestQuery, d as stripBundlerGeneratedCssMarkers, f as resolvePackageDir, n as createBundleBuildState, p as resolvePluginDisabledState, r as updateBundleBuildState, s as pushConcurrentTaskFactories, t as buildBundleSnapshot, y as isSourceStyleRequest } from "./bundle-state-CdNXQl-o.mjs";
|
|
8
8
|
import Module, { createRequire } from "node:module";
|
|
9
9
|
import fs from "node:fs";
|
|
10
10
|
import process from "node:process";
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
const require_chunk = require("./chunk-
|
|
2
|
-
const require_v3_engine = require("./v3-engine-
|
|
3
|
-
const require_generator = require("./generator-
|
|
4
|
-
const require_precheck = require("./precheck-
|
|
5
|
-
const require_utils = require("./utils-
|
|
6
|
-
const require_tailwindcss = require("./tailwindcss-
|
|
7
|
-
const require_incremental_runtime_class_set = require("./incremental-runtime-class-set-
|
|
8
|
-
const require_bundle_state = require("./bundle-state-
|
|
1
|
+
const require_chunk = require("./chunk-emK7D4bc.js");
|
|
2
|
+
const require_v3_engine = require("./v3-engine-6FVAcrZl.js");
|
|
3
|
+
const require_generator = require("./generator-C56PJYxA.js");
|
|
4
|
+
const require_precheck = require("./precheck-CyPbGn38.js");
|
|
5
|
+
const require_utils = require("./utils-Dolmt8EO.js");
|
|
6
|
+
const require_tailwindcss = require("./tailwindcss-Tw6CSVHL.js");
|
|
7
|
+
const require_incremental_runtime_class_set = require("./incremental-runtime-class-set-Bmzdjlk0.js");
|
|
8
|
+
const require_bundle_state = require("./bundle-state-CFgzVHFP.js");
|
|
9
9
|
let node_fs = require("node:fs");
|
|
10
10
|
node_fs = require_chunk.__toESM(node_fs);
|
|
11
11
|
let node_module = require("node:module");
|
package/dist/webpack.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_webpack = require("./webpack-
|
|
2
|
+
const require_webpack = require("./webpack-nn3P8_S_.js");
|
|
3
3
|
exports.WeappTailwindcss = require_webpack.WeappTailwindcss;
|
|
4
4
|
exports.weappTailwindcss = require_webpack.WeappTailwindcss;
|
|
5
5
|
exports.weappTailwindcssPackageDir = require_webpack.weappTailwindcssPackageDir;
|
package/dist/webpack.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as weappTailwindcssPackageDir, t as WeappTailwindcss } from "./webpack-
|
|
1
|
+
import { n as weappTailwindcssPackageDir, t as WeappTailwindcss } from "./webpack-CMJ7iqN7.mjs";
|
|
2
2
|
export { WeappTailwindcss, WeappTailwindcss as weappTailwindcss, weappTailwindcssPackageDir };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "weapp-tailwindcss",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.6",
|
|
4
4
|
"description": "把 tailwindcss 原子化样式思想,带给小程序开发者们! bring tailwindcss to miniprogram developers!",
|
|
5
5
|
"author": "ice breaker <1324318532@qq.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -173,7 +173,6 @@
|
|
|
173
173
|
"@babel/traverse": "~7.29.7",
|
|
174
174
|
"@babel/types": "~7.29.7",
|
|
175
175
|
"@vue/compiler-dom": "^3.5.35",
|
|
176
|
-
"@vue/compiler-sfc": "^3.5.35",
|
|
177
176
|
"@weapp-core/escape": "~8.0.0",
|
|
178
177
|
"comment-json": "^5.0.0",
|
|
179
178
|
"debug": "~4.4.3",
|
|
@@ -187,9 +186,9 @@
|
|
|
187
186
|
"tailwindcss-patch": "9.4.2",
|
|
188
187
|
"yaml": "^2.9.0",
|
|
189
188
|
"@weapp-tailwindcss/logger": "2.0.0",
|
|
190
|
-
"@weapp-tailwindcss/postcss": "3.0.
|
|
191
|
-
"@weapp-tailwindcss/reset": "0.1.1",
|
|
189
|
+
"@weapp-tailwindcss/postcss": "3.0.3",
|
|
192
190
|
"@weapp-tailwindcss/shared": "2.0.0",
|
|
191
|
+
"@weapp-tailwindcss/reset": "0.1.1",
|
|
193
192
|
"tailwindcss-config": "2.0.0"
|
|
194
193
|
},
|
|
195
194
|
"devDependencies": {
|