weapp-tailwindcss 5.0.0-next.20 → 5.0.0-next.21
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/{bundle-state-BlXvU4jl.js → bundle-state-BnV8o2Yn.js} +1 -1
- package/dist/{bundle-state-PO6MysTJ.mjs → bundle-state-CLnuf2CW.mjs} +1 -1
- package/dist/bundlers/shared/css-cleanup/at-rules.d.ts +1 -2
- package/dist/bundlers/shared/css-cleanup.d.ts +1 -8
- package/dist/core.js +1 -1
- package/dist/core.mjs +1 -1
- package/dist/{generator-N4jy1HCk.js → generator-B4RNgMLx.js} +1 -1
- package/dist/{generator-DIuglJub.mjs → generator-DvyhmC76.mjs} +1 -1
- package/dist/generator.js +2 -2
- package/dist/generator.mjs +2 -2
- package/dist/gulp.js +5 -5
- package/dist/gulp.mjs +5 -5
- package/dist/{incremental-runtime-class-set-hF-uiw6W.mjs → incremental-runtime-class-set-C7Q7fC5u.mjs} +5 -427
- package/dist/{incremental-runtime-class-set-CJ0Pnsw2.js → incremental-runtime-class-set-DZsbM0-a.js} +11 -433
- package/dist/index.js +4 -4
- package/dist/index.mjs +4 -4
- package/dist/{postcss-DlY-YRvA.js → postcss-CFa6-qO9.js} +2 -2
- package/dist/{postcss-D4UdbBQ6.mjs → postcss-Drpy7j-g.mjs} +2 -2
- package/dist/postcss.js +1 -1
- package/dist/postcss.mjs +1 -1
- package/dist/{precheck-BjEbVEpX.js → precheck-8pQbjqpq.js} +2 -2
- package/dist/{precheck-tbk626YL.mjs → precheck-D1O5AWzy.mjs} +2 -2
- package/dist/presets.js +2 -2
- package/dist/presets.mjs +2 -2
- package/dist/{runtime-registry-D5qnaSpo.js → runtime-registry-CdCV3Opt.js} +0 -20
- package/dist/{source-candidates-gxijpPI3.js → source-candidates-CUTNdsiz.js} +1 -1
- package/dist/{source-candidates-BrvneDDd.mjs → source-candidates-CnD4vyic.mjs} +1 -1
- package/dist/tailwindcss/miniprogram.d.ts +1 -5
- package/dist/tailwindcss/remove-unsupported-css.d.ts +1 -2
- package/dist/{tailwindcss-c6ROlNNW.mjs → tailwindcss-B_JAdOQf.mjs} +1 -1
- package/dist/{tailwindcss-BhG7BtB-.js → tailwindcss-whZE3HpL.js} +1 -1
- package/dist/{v3-engine-5LoZUH-4.js → v3-engine-CCwvhRrQ.js} +2 -224
- package/dist/{v3-engine-DIXDEDmL.mjs → v3-engine-DyIcbpZm.mjs} +2 -218
- package/dist/{vite-B5faZcbE.mjs → vite-B8IiXgVD.mjs} +7 -7
- package/dist/{vite-MyXBNux0.js → vite-BcnwgJMt.js} +7 -7
- package/dist/vite.js +1 -1
- package/dist/vite.mjs +1 -1
- package/dist/weapp-tw-css-import-rewrite-loader.js +13 -637
- package/dist/weapp-tw-runtime-classset-loader.js +3 -2
- package/dist/{webpack-Mz1V0A9p.js → webpack-C4zI624R.js} +5 -5
- package/dist/{webpack-BnVyDmsD.mjs → webpack-DTkshAtp.mjs} +5 -5
- package/dist/webpack.js +1 -1
- package/dist/webpack.mjs +1 -1
- package/package.json +2 -2
- package/dist/bundlers/shared/css-cleanup/color-gamut.d.ts +0 -3
- package/dist/bundlers/shared/css-cleanup/root-cleanups.d.ts +0 -5
- package/dist/bundlers/shared/css-cleanup/selectors.d.ts +0 -8
- package/dist/lightningcss/index.d.ts +0 -8
- package/dist/lightningcss/style-handler/options.d.ts +0 -3
- package/dist/lightningcss/style-handler/selector-transform.d.ts +0 -10
- package/dist/lightningcss/style-handler/selector-utils.d.ts +0 -10
- package/dist/lightningcss/style-handler.d.ts +0 -17
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const require_chunk = require("./chunk-8l464Juk.js");
|
|
2
|
-
const require_precheck = require("./precheck-
|
|
2
|
+
const require_precheck = require("./precheck-8pQbjqpq.js");
|
|
3
3
|
let node_module = require("node:module");
|
|
4
4
|
let node_path = require("node:path");
|
|
5
5
|
node_path = require_chunk.__toESM(node_path);
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
export
|
|
2
|
-
export declare function removeUnsupportedAtSupports(css: string): string;
|
|
1
|
+
export { removeUnsupportedAtSupports, removeUnsupportedMiniProgramAtRules, } from '@weapp-tailwindcss/postcss';
|
|
@@ -1,8 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export { removeUnsupportedAtSupports, removeUnsupportedMiniProgramAtRules } from './css-cleanup/at-rules';
|
|
3
|
-
interface FinalizeMiniProgramCssOptions {
|
|
4
|
-
cssPreflight?: CssPreflightOptions | undefined;
|
|
5
|
-
preservePseudoContentInit?: boolean;
|
|
6
|
-
}
|
|
7
|
-
export declare function hoistTailwindPreflightBase(css: string): string;
|
|
8
|
-
export declare function finalizeMiniProgramCss(css: string, options?: FinalizeMiniProgramCssOptions): string;
|
|
1
|
+
export { finalizeMiniProgramCss, hoistTailwindPreflightBase, removeUnsupportedAtSupports, removeUnsupportedMiniProgramAtRules, } from '@weapp-tailwindcss/postcss';
|
package/dist/core.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
require("./chunk-8l464Juk.js");
|
|
3
|
-
const require_precheck = require("./precheck-
|
|
3
|
+
const require_precheck = require("./precheck-8pQbjqpq.js");
|
|
4
4
|
let _weapp_tailwindcss_shared = require("@weapp-tailwindcss/shared");
|
|
5
5
|
//#region src/core.ts
|
|
6
6
|
const DEFAULT_MAIN_CHUNK_STYLE_OPTIONS = Object.freeze({ isMainChunk: true });
|
package/dist/core.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { _ as ensureRuntimeClassSet, g as createTailwindRuntimeReadyPromise, n as getCompilerContext, t as shouldSkipJsTransform } from "./precheck-
|
|
1
|
+
import { _ as ensureRuntimeClassSet, g as createTailwindRuntimeReadyPromise, n as getCompilerContext, t as shouldSkipJsTransform } from "./precheck-D1O5AWzy.mjs";
|
|
2
2
|
import { defuOverrideArray } from "@weapp-tailwindcss/shared";
|
|
3
3
|
//#region src/core.ts
|
|
4
4
|
const DEFAULT_MAIN_CHUNK_STYLE_OPTIONS = Object.freeze({ isMainChunk: true });
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as createTailwindV4Engine, i as createTailwindV3Engine, n as resolveTailwindV3SourceFromPatcher, x as resolveTailwindV4SourceFromPatcher } from "./v3-engine-
|
|
1
|
+
import { C as createTailwindV4Engine, i as createTailwindV3Engine, n as resolveTailwindV3SourceFromPatcher, x as resolveTailwindV4SourceFromPatcher } from "./v3-engine-DyIcbpZm.mjs";
|
|
2
2
|
//#region src/generator/options.ts
|
|
3
3
|
function normalizeWeappTailwindcssGeneratorOptions(options) {
|
|
4
4
|
if (options == null) return {
|
package/dist/generator.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
require("./chunk-8l464Juk.js");
|
|
3
|
-
const require_v3_engine = require("./v3-engine-
|
|
4
|
-
const require_generator = require("./generator-
|
|
3
|
+
const require_v3_engine = require("./v3-engine-CCwvhRrQ.js");
|
|
4
|
+
const require_generator = require("./generator-B4RNgMLx.js");
|
|
5
5
|
let tailwindcss_patch = require("tailwindcss-patch");
|
|
6
6
|
exports.createWeappTailwindcssGenerator = require_generator.createWeappTailwindcssGenerator;
|
|
7
7
|
exports.createWeappTailwindcssGeneratorFromPatcher = require_generator.createWeappTailwindcssGeneratorFromPatcher;
|
package/dist/generator.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { S as resolveTailwindV4SourceOptionsFromPatcher, T as transformTailwindV4CssToWeapp, a as transformTailwindV3CssByTarget, b as resolveTailwindV4SourceFromPatchOptions, n as resolveTailwindV3SourceFromPatcher, o as transformTailwindV3CssToWeapp, r as resolveTailwindV3SourceOptionsFromPatcher, t as resolveTailwindV3Source, w as transformTailwindV4CssByTarget, x as resolveTailwindV4SourceFromPatcher, y as resolveTailwindV4Source } from "./v3-engine-
|
|
2
|
-
import { i as normalizeWeappTailwindcssGeneratorOptions, n as createWeappTailwindcssGeneratorFromPatcher, r as resolveTailwindSourceFromPatcher, t as createWeappTailwindcssGenerator } from "./generator-
|
|
1
|
+
import { S as resolveTailwindV4SourceOptionsFromPatcher, T as transformTailwindV4CssToWeapp, a as transformTailwindV3CssByTarget, b as resolveTailwindV4SourceFromPatchOptions, n as resolveTailwindV3SourceFromPatcher, o as transformTailwindV3CssToWeapp, r as resolveTailwindV3SourceOptionsFromPatcher, t as resolveTailwindV3Source, w as transformTailwindV4CssByTarget, x as resolveTailwindV4SourceFromPatcher, y as resolveTailwindV4Source } from "./v3-engine-DyIcbpZm.mjs";
|
|
2
|
+
import { i as normalizeWeappTailwindcssGeneratorOptions, n as createWeappTailwindcssGeneratorFromPatcher, r as resolveTailwindSourceFromPatcher, t as createWeappTailwindcssGenerator } from "./generator-DvyhmC76.mjs";
|
|
3
3
|
export { createWeappTailwindcssGenerator, createWeappTailwindcssGeneratorFromPatcher, normalizeWeappTailwindcssGeneratorOptions, resolveTailwindSourceFromPatcher, resolveTailwindV3Source, resolveTailwindV3SourceFromPatcher, resolveTailwindV3SourceOptionsFromPatcher, resolveTailwindV4Source, resolveTailwindV4SourceFromPatchOptions, resolveTailwindV4SourceFromPatcher, resolveTailwindV4SourceOptionsFromPatcher, transformTailwindV3CssByTarget, transformTailwindV3CssToWeapp, transformTailwindV4CssByTarget, transformTailwindV4CssToWeapp };
|
package/dist/gulp.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_chunk = require("./chunk-8l464Juk.js");
|
|
3
|
-
const require_v3_engine = require("./v3-engine-
|
|
4
|
-
const require_incremental_runtime_class_set = require("./incremental-runtime-class-set-
|
|
5
|
-
const require_precheck = require("./precheck-
|
|
6
|
-
const require_tailwindcss = require("./tailwindcss-
|
|
7
|
-
const require_source_candidates = require("./source-candidates-
|
|
3
|
+
const require_v3_engine = require("./v3-engine-CCwvhRrQ.js");
|
|
4
|
+
const require_incremental_runtime_class_set = require("./incremental-runtime-class-set-DZsbM0-a.js");
|
|
5
|
+
const require_precheck = require("./precheck-8pQbjqpq.js");
|
|
6
|
+
const require_tailwindcss = require("./tailwindcss-whZE3HpL.js");
|
|
7
|
+
const require_source_candidates = require("./source-candidates-CUTNdsiz.js");
|
|
8
8
|
let node_fs = require("node:fs");
|
|
9
9
|
node_fs = require_chunk.__toESM(node_fs);
|
|
10
10
|
let node_path = require("node:path");
|
package/dist/gulp.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { i as generateCssByGenerator, l as normalizeTailwindSourceForGenerator, o as processCachedTask, r as emitHmrTiming, s as hasTailwindRootDirectives, t as createBundleRuntimeClassSetManager } from "./incremental-runtime-class-set-
|
|
3
|
-
import { _ as ensureRuntimeClassSet, g as createTailwindRuntimeReadyPromise, n as getCompilerContext, t as shouldSkipJsTransform } from "./precheck-
|
|
4
|
-
import { c as upsertTailwindV4CssSource, s as hasConfiguredTailwindV4CssRoots } from "./tailwindcss-
|
|
5
|
-
import { t as createSourceCandidateCollector } from "./source-candidates-
|
|
1
|
+
import { B as createDebug, _ as resolveViteSourceScanEntries, l as getRuntimeClassSetSignature } from "./v3-engine-DyIcbpZm.mjs";
|
|
2
|
+
import { i as generateCssByGenerator, l as normalizeTailwindSourceForGenerator, o as processCachedTask, r as emitHmrTiming, s as hasTailwindRootDirectives, t as createBundleRuntimeClassSetManager } from "./incremental-runtime-class-set-C7Q7fC5u.mjs";
|
|
3
|
+
import { _ as ensureRuntimeClassSet, g as createTailwindRuntimeReadyPromise, n as getCompilerContext, t as shouldSkipJsTransform } from "./precheck-D1O5AWzy.mjs";
|
|
4
|
+
import { c as upsertTailwindV4CssSource, s as hasConfiguredTailwindV4CssRoots } from "./tailwindcss-B_JAdOQf.mjs";
|
|
5
|
+
import { t as createSourceCandidateCollector } from "./source-candidates-CnD4vyic.mjs";
|
|
6
6
|
import fs from "node:fs";
|
|
7
7
|
import path from "node:path";
|
|
8
8
|
import process from "node:process";
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { D as
|
|
2
|
-
import { i as normalizeWeappTailwindcssGeneratorOptions, t as createWeappTailwindcssGenerator } from "./generator-
|
|
3
|
-
import { l as replaceWxml } from "./precheck-
|
|
4
|
-
import { i as resolveUniAppXOptions } from "./tailwindcss-
|
|
1
|
+
import { B as createDebug, D as loadTailwindV4DesignSystem, E as filterUnsupportedMiniProgramTailwindV4Candidates, G as omitUndefined, R as resolveTailwindV4CssSourceBase, S as resolveTailwindV4SourceOptionsFromPatcher, h as resolveTailwindV4EntriesFromCss, l as getRuntimeClassSetSignature, n as resolveTailwindV3SourceFromPatcher, r as resolveTailwindV3SourceOptionsFromPatcher, t as resolveTailwindV3Source, x as resolveTailwindV4SourceFromPatcher, y as resolveTailwindV4Source$1 } from "./v3-engine-DyIcbpZm.mjs";
|
|
2
|
+
import { i as normalizeWeappTailwindcssGeneratorOptions, t as createWeappTailwindcssGenerator } from "./generator-DvyhmC76.mjs";
|
|
3
|
+
import { l as replaceWxml } from "./precheck-D1O5AWzy.mjs";
|
|
4
|
+
import { i as resolveUniAppXOptions } from "./tailwindcss-B_JAdOQf.mjs";
|
|
5
5
|
import { existsSync, readFileSync } from "node:fs";
|
|
6
6
|
import postcss from "postcss";
|
|
7
7
|
import path from "node:path";
|
|
8
8
|
import process from "node:process";
|
|
9
9
|
import { extractRawCandidatesWithPositions, extractValidCandidates } from "tailwindcss-patch";
|
|
10
|
-
import {
|
|
10
|
+
import { finalizeMiniProgramCss, removeUnsupportedMiniProgramAtRules } from "@weapp-tailwindcss/postcss";
|
|
11
11
|
//#region src/bundlers/shared/generator-css/markers.ts
|
|
12
12
|
const TAILWIND_V4_BANNER_RE = /\/\*!\s*tailwindcss v4\./;
|
|
13
13
|
const TAILWIND_GENERATED_CSS_MARKER_RE = /\/\*!\s*tailwindcss v|@property\s+--tw-|--tw-|:not\(#\\#\)|\.[^,{]*(?:\\:|\\\[|\\#)|(?::host|page|\.tw-root|wx-root-portal-content)[^{]*\{[^}]*--(?:color|spacing|text|font-weight|radius)-/;
|
|
@@ -374,428 +374,6 @@ async function processCachedTask({ cache, cacheKey, hashKey = cacheKey, rawSourc
|
|
|
374
374
|
if (!cacheHit) await applyResult(result);
|
|
375
375
|
}
|
|
376
376
|
//#endregion
|
|
377
|
-
//#region src/bundlers/shared/css-cleanup/at-rules.ts
|
|
378
|
-
const MINI_PROGRAM_UNSUPPORTED_AT_RULES = new Set(["property", "supports"]);
|
|
379
|
-
function removeAtRulesByScan(css, names) {
|
|
380
|
-
let index = 0;
|
|
381
|
-
let result = "";
|
|
382
|
-
const atRulePattern = new RegExp(`@(?:${[...names].join("|")})\\b`, "i");
|
|
383
|
-
while (index < css.length) {
|
|
384
|
-
const match = atRulePattern.exec(css.slice(index));
|
|
385
|
-
if (!match || match.index === void 0) {
|
|
386
|
-
result += css.slice(index);
|
|
387
|
-
break;
|
|
388
|
-
}
|
|
389
|
-
const start = index + match.index;
|
|
390
|
-
result += css.slice(index, start);
|
|
391
|
-
const blockStart = css.indexOf("{", start);
|
|
392
|
-
if (blockStart === -1) {
|
|
393
|
-
result += css.slice(start);
|
|
394
|
-
break;
|
|
395
|
-
}
|
|
396
|
-
let depth = 0;
|
|
397
|
-
let cursor = blockStart;
|
|
398
|
-
for (; cursor < css.length; cursor++) {
|
|
399
|
-
const char = css[cursor];
|
|
400
|
-
if (char === "{") depth++;
|
|
401
|
-
else if (char === "}") {
|
|
402
|
-
depth--;
|
|
403
|
-
if (depth === 0) {
|
|
404
|
-
cursor++;
|
|
405
|
-
break;
|
|
406
|
-
}
|
|
407
|
-
}
|
|
408
|
-
}
|
|
409
|
-
index = cursor;
|
|
410
|
-
}
|
|
411
|
-
return result;
|
|
412
|
-
}
|
|
413
|
-
function removeUnsupportedMiniProgramAtRules(css) {
|
|
414
|
-
try {
|
|
415
|
-
const root = postcss.parse(css);
|
|
416
|
-
root.walkAtRules((atRule) => {
|
|
417
|
-
if (MINI_PROGRAM_UNSUPPORTED_AT_RULES.has(atRule.name)) atRule.remove();
|
|
418
|
-
});
|
|
419
|
-
root.walkAtRules((atRule) => {
|
|
420
|
-
if (atRule.nodes && atRule.nodes.length === 0) atRule.remove();
|
|
421
|
-
});
|
|
422
|
-
return root.toString();
|
|
423
|
-
} catch {
|
|
424
|
-
return removeAtRulesByScan(css, MINI_PROGRAM_UNSUPPORTED_AT_RULES);
|
|
425
|
-
}
|
|
426
|
-
}
|
|
427
|
-
//#endregion
|
|
428
|
-
//#region src/bundlers/shared/css-cleanup/color-gamut.ts
|
|
429
|
-
const DISPLAY_P3_VALUE_RE = /color\(\s*display-p3\b/i;
|
|
430
|
-
const COLOR_GAMUT_P3_RE = /\(\s*color-gamut\s*:\s*p3\s*\)/i;
|
|
431
|
-
function isDisplayP3MediaRule(atRule) {
|
|
432
|
-
return atRule.name === "media" && COLOR_GAMUT_P3_RE.test(atRule.params);
|
|
433
|
-
}
|
|
434
|
-
function isDisplayP3Declaration(decl) {
|
|
435
|
-
return DISPLAY_P3_VALUE_RE.test(decl.value);
|
|
436
|
-
}
|
|
437
|
-
//#endregion
|
|
438
|
-
//#region src/bundlers/shared/css-cleanup/selectors.ts
|
|
439
|
-
const MINI_PROGRAM_THEME_SCOPE_SELECTOR = ":host,page,.tw-root,wx-root-portal-content";
|
|
440
|
-
const MINI_PROGRAM_PREFLIGHT_SELECTORS = new Set([
|
|
441
|
-
"*",
|
|
442
|
-
"view",
|
|
443
|
-
"text",
|
|
444
|
-
":before",
|
|
445
|
-
":after",
|
|
446
|
-
"::before",
|
|
447
|
-
"::after"
|
|
448
|
-
]);
|
|
449
|
-
const MINI_PROGRAM_THEME_SCOPE_SELECTORS$1 = new Set([
|
|
450
|
-
":host",
|
|
451
|
-
":root",
|
|
452
|
-
"page",
|
|
453
|
-
".tw-root",
|
|
454
|
-
"wx-root-portal-content"
|
|
455
|
-
]);
|
|
456
|
-
const SPECIFICITY_PLACEHOLDER_SUFFIXES = [":not(#n)", ":not(#\\#)"];
|
|
457
|
-
const MINI_PROGRAM_UNSUPPORTED_BROWSER_SELECTORS = new Set([
|
|
458
|
-
":-moz-focusring",
|
|
459
|
-
":-moz-ui-invalid",
|
|
460
|
-
"::-webkit-calendar-picker-indicator",
|
|
461
|
-
"::-webkit-date-and-time-value",
|
|
462
|
-
"::-webkit-datetime-edit",
|
|
463
|
-
"::-webkit-datetime-edit-day-field",
|
|
464
|
-
"::-webkit-datetime-edit-fields-wrapper",
|
|
465
|
-
"::-webkit-datetime-edit-hour-field",
|
|
466
|
-
"::-webkit-datetime-edit-meridiem-field",
|
|
467
|
-
"::-webkit-datetime-edit-millisecond-field",
|
|
468
|
-
"::-webkit-datetime-edit-minute-field",
|
|
469
|
-
"::-webkit-datetime-edit-month-field",
|
|
470
|
-
"::-webkit-datetime-edit-second-field",
|
|
471
|
-
"::-webkit-datetime-edit-year-field",
|
|
472
|
-
"::-webkit-inner-spin-button",
|
|
473
|
-
"::-webkit-input-placeholder",
|
|
474
|
-
"::-webkit-outer-spin-button",
|
|
475
|
-
"::-webkit-search-decoration",
|
|
476
|
-
"::placeholder",
|
|
477
|
-
"[hidden]:where(:not([hidden='until-found']))"
|
|
478
|
-
]);
|
|
479
|
-
const MINI_PROGRAM_UNSUPPORTED_BROWSER_TAG_SELECTORS = new Set([
|
|
480
|
-
"a",
|
|
481
|
-
"abbr:where([title])",
|
|
482
|
-
"audio",
|
|
483
|
-
"b",
|
|
484
|
-
"button",
|
|
485
|
-
"canvas",
|
|
486
|
-
"code",
|
|
487
|
-
"embed",
|
|
488
|
-
"h1",
|
|
489
|
-
"h2",
|
|
490
|
-
"h3",
|
|
491
|
-
"h4",
|
|
492
|
-
"h5",
|
|
493
|
-
"h6",
|
|
494
|
-
"hr",
|
|
495
|
-
"html",
|
|
496
|
-
"iframe",
|
|
497
|
-
"img",
|
|
498
|
-
"input",
|
|
499
|
-
"input:where([type='button'],[type='reset'],[type='submit'])",
|
|
500
|
-
"kbd",
|
|
501
|
-
"menu",
|
|
502
|
-
"object",
|
|
503
|
-
"ol",
|
|
504
|
-
"optgroup",
|
|
505
|
-
"pre",
|
|
506
|
-
"progress",
|
|
507
|
-
"samp",
|
|
508
|
-
"select",
|
|
509
|
-
"select[multiple]optgroup",
|
|
510
|
-
"select[multiple]optgroupoption",
|
|
511
|
-
"select[size]optgroup",
|
|
512
|
-
"select[size]optgroupoption",
|
|
513
|
-
"small",
|
|
514
|
-
"strong",
|
|
515
|
-
"sub",
|
|
516
|
-
"summary",
|
|
517
|
-
"sup",
|
|
518
|
-
"svg",
|
|
519
|
-
"table",
|
|
520
|
-
"textarea",
|
|
521
|
-
"ul",
|
|
522
|
-
"video"
|
|
523
|
-
]);
|
|
524
|
-
function normalizeSelector(selector) {
|
|
525
|
-
return selector.trim().replace(/\s+/g, "");
|
|
526
|
-
}
|
|
527
|
-
function getRuleSelectors(rule) {
|
|
528
|
-
return rule.selector.split(",").map(normalizeSelector).filter(Boolean);
|
|
529
|
-
}
|
|
530
|
-
function isUnsupportedBrowserSelector(selector) {
|
|
531
|
-
const normalized = normalizeSelector(selector);
|
|
532
|
-
return MINI_PROGRAM_UNSUPPORTED_BROWSER_SELECTORS.has(normalized) || MINI_PROGRAM_UNSUPPORTED_BROWSER_TAG_SELECTORS.has(normalized);
|
|
533
|
-
}
|
|
534
|
-
//#endregion
|
|
535
|
-
//#region src/bundlers/shared/css-cleanup/root-cleanups.ts
|
|
536
|
-
function removeSpecificityPlaceholders(root) {
|
|
537
|
-
root.walkRules((rule) => {
|
|
538
|
-
if (!rule.selectors || rule.selectors.length === 0) return;
|
|
539
|
-
let changed = false;
|
|
540
|
-
const selectors = rule.selectors.map((selector) => {
|
|
541
|
-
let next = selector;
|
|
542
|
-
for (const suffix of SPECIFICITY_PLACEHOLDER_SUFFIXES) if (next.includes(suffix)) next = next.split(suffix).join("");
|
|
543
|
-
if (next !== selector) changed = true;
|
|
544
|
-
return next;
|
|
545
|
-
});
|
|
546
|
-
if (changed) rule.selectors = selectors;
|
|
547
|
-
});
|
|
548
|
-
}
|
|
549
|
-
function removeEmptyAtRuleAncestors(parent) {
|
|
550
|
-
while (parent?.type === "atrule" && (!parent.nodes || parent.nodes.length === 0)) {
|
|
551
|
-
const nextParent = parent.parent;
|
|
552
|
-
parent.remove();
|
|
553
|
-
parent = nextParent?.type === "atrule" ? nextParent : void 0;
|
|
554
|
-
}
|
|
555
|
-
}
|
|
556
|
-
function removeUnsupportedBrowserSelectors(root) {
|
|
557
|
-
root.walkRules((rule) => {
|
|
558
|
-
if (!rule.selectors || rule.selectors.length === 0) return;
|
|
559
|
-
const selectors = rule.selectors.filter((selector) => !isUnsupportedBrowserSelector(selector));
|
|
560
|
-
if (selectors.length === rule.selectors.length) return;
|
|
561
|
-
if (selectors.length === 0) {
|
|
562
|
-
const parent = rule.parent;
|
|
563
|
-
rule.remove();
|
|
564
|
-
removeEmptyAtRuleAncestors(parent);
|
|
565
|
-
return;
|
|
566
|
-
}
|
|
567
|
-
rule.selectors = selectors;
|
|
568
|
-
});
|
|
569
|
-
}
|
|
570
|
-
function removeDeclarationAndEmptyRule(decl) {
|
|
571
|
-
const parent = decl.parent;
|
|
572
|
-
decl.remove();
|
|
573
|
-
if (parent?.type === "rule" && parent.nodes.length === 0) {
|
|
574
|
-
const ruleParent = parent.parent;
|
|
575
|
-
parent.remove();
|
|
576
|
-
removeEmptyAtRuleAncestors(ruleParent);
|
|
577
|
-
}
|
|
578
|
-
}
|
|
579
|
-
function removeDisplayP3Declarations(root) {
|
|
580
|
-
root.walkAtRules((atRule) => {
|
|
581
|
-
if (isDisplayP3MediaRule(atRule)) {
|
|
582
|
-
const parent = atRule.parent;
|
|
583
|
-
atRule.remove();
|
|
584
|
-
removeEmptyAtRuleAncestors(parent);
|
|
585
|
-
}
|
|
586
|
-
});
|
|
587
|
-
}
|
|
588
|
-
function removeUnsupportedModernColorDeclarations(root) {
|
|
589
|
-
const customPropertyValues = /* @__PURE__ */ new Map();
|
|
590
|
-
root.walkDecls((decl) => {
|
|
591
|
-
if (decl.prop.startsWith("--")) customPropertyValues.set(decl.prop, decl.value.trim());
|
|
592
|
-
});
|
|
593
|
-
root.walkDecls((decl) => {
|
|
594
|
-
const normalized = normalizeModernColorValue(decl.value, customPropertyValues);
|
|
595
|
-
if (normalized.changed) {
|
|
596
|
-
decl.value = normalized.value;
|
|
597
|
-
if (decl.prop.startsWith("--")) customPropertyValues.set(decl.prop, decl.value.trim());
|
|
598
|
-
}
|
|
599
|
-
if (normalized.hasUnsupported) removeDeclarationAndEmptyRule(decl);
|
|
600
|
-
});
|
|
601
|
-
}
|
|
602
|
-
//#endregion
|
|
603
|
-
//#region src/bundlers/shared/css-cleanup.ts
|
|
604
|
-
const PREFLIGHT_RESET_PROPS = new Set([
|
|
605
|
-
"box-sizing",
|
|
606
|
-
"border",
|
|
607
|
-
"border-width",
|
|
608
|
-
"border-style",
|
|
609
|
-
"border-color",
|
|
610
|
-
"margin",
|
|
611
|
-
"padding"
|
|
612
|
-
]);
|
|
613
|
-
const CONTENT_VAR_RE = /var\(\s*--tw-content\b/;
|
|
614
|
-
const HOIST_ANCHOR_COMMENT = "__weapp_tailwindcss_base_anchor__";
|
|
615
|
-
function isMiniProgramThemeScopeSelector$1(selectors) {
|
|
616
|
-
return selectors.length > 0 && selectors.every((selector) => MINI_PROGRAM_THEME_SCOPE_SELECTORS$1.has(selector));
|
|
617
|
-
}
|
|
618
|
-
function isMiniProgramPreflightSelector(selectors) {
|
|
619
|
-
return selectors.length > 0 && selectors.every((selector) => MINI_PROGRAM_PREFLIGHT_SELECTORS.has(selector)) && selectors.some((selector) => selector === "*" || selector === ":before" || selector === ":after" || selector === "::before" || selector === "::after");
|
|
620
|
-
}
|
|
621
|
-
function hasTailwindPreflightDeclaration(rule) {
|
|
622
|
-
let hasTailwindVar = false;
|
|
623
|
-
let hasResetProp = false;
|
|
624
|
-
rule.walkDecls((decl) => {
|
|
625
|
-
if (decl.prop.startsWith("--tw-")) hasTailwindVar = true;
|
|
626
|
-
if (PREFLIGHT_RESET_PROPS.has(decl.prop)) hasResetProp = true;
|
|
627
|
-
});
|
|
628
|
-
return hasTailwindVar || hasResetProp;
|
|
629
|
-
}
|
|
630
|
-
function isCustomPropertyOnlyRule$1(rule) {
|
|
631
|
-
let hasDeclaration = false;
|
|
632
|
-
let allCustomProperties = true;
|
|
633
|
-
rule.each((node) => {
|
|
634
|
-
if (node.type !== "decl") return;
|
|
635
|
-
hasDeclaration = true;
|
|
636
|
-
if (!node.prop.startsWith("--")) allCustomProperties = false;
|
|
637
|
-
});
|
|
638
|
-
return hasDeclaration && allCustomProperties;
|
|
639
|
-
}
|
|
640
|
-
function hasContentInitDeclaration(rule) {
|
|
641
|
-
let hasContentInit = false;
|
|
642
|
-
rule.walkDecls("--tw-content", () => {
|
|
643
|
-
hasContentInit = true;
|
|
644
|
-
});
|
|
645
|
-
return hasContentInit;
|
|
646
|
-
}
|
|
647
|
-
function isEmptyContentInitDeclaration(decl) {
|
|
648
|
-
return decl.prop === "--tw-content" && (decl.value === "\"\"" || decl.value === "''");
|
|
649
|
-
}
|
|
650
|
-
function usesTwContentVariable(root) {
|
|
651
|
-
let used = false;
|
|
652
|
-
root.walkDecls((decl) => {
|
|
653
|
-
if (CONTENT_VAR_RE.test(decl.value)) used = true;
|
|
654
|
-
});
|
|
655
|
-
return used;
|
|
656
|
-
}
|
|
657
|
-
function isTailwindPreflightRule(node) {
|
|
658
|
-
if (node.type !== "rule" || node.parent?.type !== "root") return false;
|
|
659
|
-
const rule = node;
|
|
660
|
-
return isMiniProgramPreflightSelector(getRuleSelectors(rule)) && hasTailwindPreflightDeclaration(rule);
|
|
661
|
-
}
|
|
662
|
-
function isMiniProgramThemeVariableRule(node) {
|
|
663
|
-
if (node.type !== "rule" || node.parent?.type !== "root") return false;
|
|
664
|
-
const rule = node;
|
|
665
|
-
return isMiniProgramThemeScopeSelector$1(getRuleSelectors(rule)) && isCustomPropertyOnlyRule$1(rule);
|
|
666
|
-
}
|
|
667
|
-
function createPseudoContentInitRule() {
|
|
668
|
-
const rule = postcss.rule({ selector: "::before,\n::after" });
|
|
669
|
-
rule.append({
|
|
670
|
-
prop: "--tw-content",
|
|
671
|
-
value: "''"
|
|
672
|
-
});
|
|
673
|
-
return rule;
|
|
674
|
-
}
|
|
675
|
-
function collectPreflightRules(root, options = {}) {
|
|
676
|
-
const preflightNodes = [];
|
|
677
|
-
let hasContentInit = false;
|
|
678
|
-
for (const node of root.nodes ?? []) if (isTailwindPreflightRule(node)) {
|
|
679
|
-
preflightNodes.push(node);
|
|
680
|
-
if (hasContentInitDeclaration(node)) hasContentInit = true;
|
|
681
|
-
}
|
|
682
|
-
if (preflightNodes.length === 0) return [];
|
|
683
|
-
const clonedPreflightRules = preflightNodes.map((node) => node.clone());
|
|
684
|
-
const contentInitRules = options.preservePseudoContentInit ? clonedPreflightRules.filter((rule) => hasContentInitDeclaration(rule)) : [];
|
|
685
|
-
const otherPreflightRules = clonedPreflightRules.filter((rule) => !hasContentInitDeclaration(rule));
|
|
686
|
-
const preflightRules = hasContentInit ? [...contentInitRules, ...otherPreflightRules] : [...options.preservePseudoContentInit ? [createPseudoContentInitRule()] : [], ...otherPreflightRules];
|
|
687
|
-
for (const node of preflightNodes) node.remove();
|
|
688
|
-
return preflightRules;
|
|
689
|
-
}
|
|
690
|
-
function createPreflightResetRule(cssPreflight) {
|
|
691
|
-
if (!cssPreflight || typeof cssPreflight !== "object") return;
|
|
692
|
-
const rule = postcss.rule({ selector: "view,text,:after,:before" });
|
|
693
|
-
for (const [prop, value] of Object.entries(cssPreflight)) {
|
|
694
|
-
if (value === false) continue;
|
|
695
|
-
rule.append({
|
|
696
|
-
prop,
|
|
697
|
-
value: value.toString()
|
|
698
|
-
});
|
|
699
|
-
}
|
|
700
|
-
return rule.nodes?.length ? rule : void 0;
|
|
701
|
-
}
|
|
702
|
-
function collectThemeVariableRule(root, options = {}) {
|
|
703
|
-
const themeRules = [];
|
|
704
|
-
const declarations = /* @__PURE__ */ new Map();
|
|
705
|
-
const shouldPreserveContentInit = options.preservePseudoContentInit || usesTwContentVariable(root);
|
|
706
|
-
for (const node of root.nodes ?? []) {
|
|
707
|
-
if (!isMiniProgramThemeVariableRule(node)) continue;
|
|
708
|
-
themeRules.push(node);
|
|
709
|
-
node.walkDecls((decl) => {
|
|
710
|
-
if (isDisplayP3Declaration(decl)) return;
|
|
711
|
-
if (!shouldPreserveContentInit && isEmptyContentInitDeclaration(decl)) return;
|
|
712
|
-
declarations.set(decl.prop, decl.clone());
|
|
713
|
-
});
|
|
714
|
-
}
|
|
715
|
-
for (const rule of themeRules) rule.remove();
|
|
716
|
-
if (declarations.size === 0) return;
|
|
717
|
-
const rule = postcss.rule({ selector: MINI_PROGRAM_THEME_SCOPE_SELECTOR });
|
|
718
|
-
for (const decl of declarations.values()) rule.append(decl);
|
|
719
|
-
return rule;
|
|
720
|
-
}
|
|
721
|
-
function getTopDirectiveTail(root) {
|
|
722
|
-
let tail;
|
|
723
|
-
for (const node of root.nodes ?? []) {
|
|
724
|
-
if (node.type === "atrule" && (node.name === "charset" || node.name === "import")) {
|
|
725
|
-
tail = node;
|
|
726
|
-
continue;
|
|
727
|
-
}
|
|
728
|
-
break;
|
|
729
|
-
}
|
|
730
|
-
return tail;
|
|
731
|
-
}
|
|
732
|
-
function createHoistInsertionAnchor(root) {
|
|
733
|
-
for (const node of root.nodes ?? []) if (isTailwindPreflightRule(node) || isMiniProgramThemeVariableRule(node)) {
|
|
734
|
-
const anchor = postcss.comment({ text: HOIST_ANCHOR_COMMENT });
|
|
735
|
-
node.before(anchor);
|
|
736
|
-
return anchor;
|
|
737
|
-
}
|
|
738
|
-
}
|
|
739
|
-
function insertHoistedRules(root, rules, anchor) {
|
|
740
|
-
if (anchor && !anchor.parent) anchor = void 0;
|
|
741
|
-
if (rules.length === 0) {
|
|
742
|
-
anchor?.remove();
|
|
743
|
-
return;
|
|
744
|
-
}
|
|
745
|
-
const topDirectiveTail = getTopDirectiveTail(root);
|
|
746
|
-
const firstRule = rules[0];
|
|
747
|
-
if (!firstRule) return;
|
|
748
|
-
if (anchor) {
|
|
749
|
-
if (anchor.raws.before === void 0) delete firstRule.raws.before;
|
|
750
|
-
else firstRule.raws.before = anchor.raws.before;
|
|
751
|
-
anchor.replaceWith(rules);
|
|
752
|
-
return;
|
|
753
|
-
}
|
|
754
|
-
firstRule.raws.before = topDirectiveTail ? "\n" : "";
|
|
755
|
-
if (topDirectiveTail) topDirectiveTail.after(rules);
|
|
756
|
-
else root.prepend(rules);
|
|
757
|
-
}
|
|
758
|
-
function finalizeMiniProgramCssRoot(root, options = {}) {
|
|
759
|
-
removeUnsupportedCascadeLayers(root);
|
|
760
|
-
unwrapTailwindSourceMedia(root);
|
|
761
|
-
root.walkAtRules("property", (atRule) => {
|
|
762
|
-
atRule.remove();
|
|
763
|
-
});
|
|
764
|
-
removeSpecificityPlaceholders(root);
|
|
765
|
-
removeUnsupportedBrowserSelectors(root);
|
|
766
|
-
removeDisplayP3Declarations(root);
|
|
767
|
-
removeUnsupportedModernColorDeclarations(root);
|
|
768
|
-
root.walkDecls((decl) => {
|
|
769
|
-
normalizeMiniProgramPrefixedDeclaration(decl);
|
|
770
|
-
});
|
|
771
|
-
root.walkAtRules((atRule) => {
|
|
772
|
-
removeUnsupportedMiniProgramPrefixedAtRule(atRule);
|
|
773
|
-
});
|
|
774
|
-
const hoistAnchor = createHoistInsertionAnchor(root);
|
|
775
|
-
const preflightRules = collectPreflightRules(root, options);
|
|
776
|
-
if (preflightRules.length === 0) {
|
|
777
|
-
const resetRule = createPreflightResetRule(options.cssPreflight);
|
|
778
|
-
if (resetRule) preflightRules.push(resetRule);
|
|
779
|
-
}
|
|
780
|
-
const themeRule = collectThemeVariableRule(root, options);
|
|
781
|
-
insertHoistedRules(root, themeRule ? [...preflightRules, themeRule] : preflightRules, hoistAnchor);
|
|
782
|
-
}
|
|
783
|
-
function unwrapTailwindSourceMedia(root) {
|
|
784
|
-
root.walkAtRules("media", (atRule) => {
|
|
785
|
-
if (atRule.params.startsWith("source(") && atRule.nodes && atRule.nodes.length > 0) atRule.replaceWith(...atRule.nodes);
|
|
786
|
-
});
|
|
787
|
-
}
|
|
788
|
-
function finalizeMiniProgramCss(css, options = {}) {
|
|
789
|
-
const cleanedCss = removeUnsupportedMiniProgramAtRules(css);
|
|
790
|
-
try {
|
|
791
|
-
const root = postcss.parse(cleanedCss);
|
|
792
|
-
finalizeMiniProgramCssRoot(root, options);
|
|
793
|
-
return root.toString();
|
|
794
|
-
} catch {
|
|
795
|
-
return cleanedCss;
|
|
796
|
-
}
|
|
797
|
-
}
|
|
798
|
-
//#endregion
|
|
799
377
|
//#region src/bundlers/shared/generator-css/legacy-selectors.ts
|
|
800
378
|
const CLASS_SELECTOR_RE = /(?:^|[^\w-])\.[_a-z\u00A0-\uFFFF\\-]/i;
|
|
801
379
|
const MINI_PROGRAM_THEME_SCOPE_SELECTORS = new Set([
|