weapp-tailwindcss 5.1.12 → 5.1.14
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/bundlers/vite/css-finalizer.d.ts +1 -0
- package/dist/bundlers/vite/frameworks/taro/index.d.ts +2 -0
- package/dist/bundlers/vite/frameworks/uni-app/index.d.ts +2 -0
- package/dist/bundlers/vite/frameworks/uni-app-x/index.d.ts +2 -0
- package/dist/bundlers/vite/generate-bundle/remembered-css-replay.d.ts +3 -0
- package/dist/bundlers/vite/generate-bundle/root-style-output.d.ts +18 -0
- package/dist/bundlers/vite/generate-bundle/types.d.ts +2 -0
- package/dist/bundlers/vite/serve-root-import-shell.d.ts +8 -0
- package/dist/bundlers/vite/source-candidates.d.ts +3 -0
- package/dist/{context-xSJE588m.mjs → context-BL8Gy71H.mjs} +5 -3
- package/dist/{context-DRRgW7i2.js → context-VeFq_8vW.js} +5 -3
- package/dist/core.js +1 -1
- package/dist/core.mjs +1 -1
- package/dist/{generator-BvPcmqxU.mjs → generator-B59OA64h.mjs} +17 -3
- package/dist/{generator-CS10c9g1.js → generator-CEnUsjed.js} +17 -3
- package/dist/generator.js +1 -1
- package/dist/generator.mjs +1 -1
- package/dist/{gulp-DNZZvUMq.js → gulp-C1Q3LRzg.js} +9 -5
- package/dist/{gulp-BEOzXrbp.mjs → gulp-DUYWxmZC.mjs} +9 -5
- package/dist/gulp.js +1 -1
- package/dist/gulp.mjs +1 -1
- package/dist/{hmr-timing-DW1g3zjl.js → hmr-timing-BZ5sWIqO.js} +104 -14
- package/dist/{hmr-timing-hRhRAjYV.mjs → hmr-timing-C3ed5vCx.mjs} +105 -15
- package/dist/index.js +4 -4
- package/dist/index.mjs +4 -4
- package/dist/postcss.js +1 -1
- package/dist/postcss.mjs +1 -1
- package/dist/presets.js +1 -1
- package/dist/presets.mjs +1 -1
- package/dist/rspack.js +1 -1
- package/dist/rspack.mjs +1 -1
- package/dist/{source-candidate-scan-signature-t4XKAQ04.mjs → source-candidate-scan-signature-D7RWjWsY.mjs} +17 -44
- package/dist/{source-candidate-scan-signature-CMgu5bJk.js → source-candidate-scan-signature-R3dzamcm.js} +17 -44
- package/dist/tailwindcss/candidates.d.ts +4 -0
- package/dist/{tailwindcss-DZT_pWrd.mjs → tailwindcss-DPcKMLxL.mjs} +1 -1
- package/dist/{tailwindcss-z9JMF-qU.js → tailwindcss-KBYPJ2DW.js} +1 -1
- package/dist/{vite-VGfkFQkC.js → vite-BNlPdsGM.js} +272 -59
- package/dist/{vite-DF1gE6a5.mjs → vite-CBU5NXTX.mjs} +272 -59
- package/dist/vite.js +1 -1
- package/dist/vite.mjs +1 -1
- package/dist/weapp-tw-css-import-rewrite-loader.js +2061 -15
- package/dist/{webpack-CTYm19zA.mjs → webpack-CZ38fMGC.mjs} +10 -6
- package/dist/{webpack-CzXjfvYS.js → webpack-Jpe048pQ.js} +10 -6
- package/dist/webpack.js +1 -1
- package/dist/webpack.mjs +1 -1
- package/package.json +2 -2
|
@@ -37,6 +37,7 @@ interface CssFinalizerContext {
|
|
|
37
37
|
rememberMainCssSource?: (file: string, rawSource: string) => void;
|
|
38
38
|
getRememberedMainCssSource?: (file: string) => RememberedMainCssSource | undefined;
|
|
39
39
|
isViteProcessedCssAsset?: (asset: OutputAsset, file?: string) => boolean;
|
|
40
|
+
frameworkRootImportShellTargetByFile?: ReadonlyMap<string, string> | undefined;
|
|
40
41
|
}
|
|
41
42
|
export declare function createViteCssFinalizerOutputPlugin(context: CssFinalizerContext): Plugin;
|
|
42
43
|
export {};
|
|
@@ -1,2 +1,4 @@
|
|
|
1
|
+
import type { ViteFrameworkCssPipelineStrategy } from '../../shared/framework-strategy';
|
|
1
2
|
import type { InternalUserDefinedOptions, UserDefinedOptions } from '../../../../types';
|
|
3
|
+
export declare const taroCssPipelineStrategy: ViteFrameworkCssPipelineStrategy;
|
|
2
4
|
export declare function createTaroVitePlugins(options?: UserDefinedOptions | InternalUserDefinedOptions): any[];
|
|
@@ -1,2 +1,4 @@
|
|
|
1
|
+
import type { ViteFrameworkCssPipelineStrategy } from '../../shared/framework-strategy';
|
|
1
2
|
import type { InternalUserDefinedOptions, UserDefinedOptions } from '../../../../types';
|
|
3
|
+
export declare const uniAppCssPipelineStrategy: ViteFrameworkCssPipelineStrategy;
|
|
2
4
|
export declare function createUniAppVitePlugins(options?: UserDefinedOptions | InternalUserDefinedOptions): import("../..").WeappTailwindcssVitePlugin[] | undefined;
|
|
@@ -1,2 +1,4 @@
|
|
|
1
|
+
import type { ViteFrameworkCssPipelineStrategy } from '../../shared/framework-strategy';
|
|
1
2
|
import type { InternalUserDefinedOptions, UserDefinedOptions } from '../../../../types';
|
|
3
|
+
export declare const uniAppXCssPipelineStrategy: ViteFrameworkCssPipelineStrategy;
|
|
2
4
|
export declare function createUniAppXVitePlugins(options?: UserDefinedOptions | InternalUserDefinedOptions): import("../..").WeappTailwindcssVitePlugin[] | undefined;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { OutputAsset, OutputChunk } from 'rollup';
|
|
2
|
+
import type { ViteFrameworkCssPipelineContext, ViteFrameworkCssPipelineStrategy } from '../shared/framework-strategy';
|
|
2
3
|
import type { BundleMetrics } from './metrics';
|
|
3
4
|
import type { GenerateBundleContext, RememberedCssSource } from './types';
|
|
4
5
|
interface ProcessRememberedCssReplayOptions {
|
|
@@ -17,6 +18,8 @@ interface ProcessRememberedCssReplayOptions {
|
|
|
17
18
|
isMainChunk?: boolean | undefined;
|
|
18
19
|
}) => GenerateBundleContext['getSourceCandidateSourcesForEntries'];
|
|
19
20
|
cssTaskFactories: Array<() => Promise<void>>;
|
|
21
|
+
cssPipelineContext: ViteFrameworkCssPipelineContext;
|
|
22
|
+
cssPipelineStrategy?: ViteFrameworkCssPipelineStrategy | undefined;
|
|
20
23
|
debug: GenerateBundleContext['debug'];
|
|
21
24
|
defaultStyleOutputExtension: string;
|
|
22
25
|
emitOrReplayCssAsset: (fileName: string, source: string) => OutputAsset | undefined;
|
|
@@ -1,6 +1,24 @@
|
|
|
1
|
+
import type { OutputBundle } from 'rollup';
|
|
1
2
|
export declare function isRootMiniProgramStyleOutputFile(file: string): boolean;
|
|
2
3
|
export declare function createRelativeCssImportRequest(targetFile: string, importedFile: string): string;
|
|
3
4
|
export declare function createCssImportShell(targetFile: string, importedFile: string): string;
|
|
5
|
+
export declare function resolveSingleCssImportOutputFile(targetFile: string, css: string): string | undefined;
|
|
4
6
|
export declare function createRootMiniProgramOriginStyleOutputFile(file: string): string;
|
|
5
7
|
export declare function shouldKeepRootMiniProgramStyleAsImportShell(enabled: boolean | undefined): enabled is true;
|
|
8
|
+
export declare function shouldPreserveFrameworkRootMiniProgramImportShell(options: {
|
|
9
|
+
css: string;
|
|
10
|
+
file: string;
|
|
11
|
+
isWebGeneratorTarget: boolean;
|
|
12
|
+
matchesCss: boolean;
|
|
13
|
+
shouldKeep: () => boolean | undefined;
|
|
14
|
+
}): boolean;
|
|
15
|
+
export declare function restoreFrameworkRootMiniProgramImportShellAssets(bundle: OutputBundle, options: {
|
|
16
|
+
debug?: ((format: string, ...args: unknown[]) => void) | undefined;
|
|
17
|
+
isWebGeneratorTarget: boolean;
|
|
18
|
+
matchesCss: (file: string) => boolean;
|
|
19
|
+
onUpdate?: ((file: string, oldVal: string, newVal: string) => void) | undefined;
|
|
20
|
+
recordCssAssetResult?: ((file: string, css: string) => void) | undefined;
|
|
21
|
+
shouldKeep: (file: string, css: string) => boolean | undefined;
|
|
22
|
+
targetByFile: ReadonlyMap<string, string>;
|
|
23
|
+
}): number;
|
|
6
24
|
export declare function shouldMoveRootMiniProgramStyleToImportShellOrigin(enabled: boolean | undefined): enabled is true;
|
|
@@ -52,6 +52,7 @@ export interface GenerateBundleContext {
|
|
|
52
52
|
setRememberedCssSignature?: (file: string, cssRuntimeSignature: string) => void;
|
|
53
53
|
getKnownCssSource?: (file: string) => string | undefined;
|
|
54
54
|
getKnownSfcSource?: (file: string) => string | undefined;
|
|
55
|
+
getOriginalCssLayerSource?: (file: string) => string | undefined;
|
|
55
56
|
recordGeneratorCandidates?: (candidates: Set<string>) => void;
|
|
56
57
|
pruneViteCssCaches?: (options: {
|
|
57
58
|
activeFiles: Set<string>;
|
|
@@ -60,6 +61,7 @@ export interface GenerateBundleContext {
|
|
|
60
61
|
getViteCssCacheStats?: () => Record<string, unknown>;
|
|
61
62
|
hmrTimingRecorder?: HmrTimingRecorder;
|
|
62
63
|
cssPipelineStrategy?: ViteFrameworkCssPipelineStrategy | undefined;
|
|
64
|
+
frameworkRootImportShellTargetByFile?: Map<string, string> | undefined;
|
|
63
65
|
}
|
|
64
66
|
export interface RememberedCssSource {
|
|
65
67
|
outputFile: string;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ViteFrameworkCssPipelineContext, ViteFrameworkCssPipelineStrategy } from './shared/framework-strategy';
|
|
2
|
+
export declare function resolveViteServeRootMiniProgramImportShell(options: {
|
|
3
|
+
css: string;
|
|
4
|
+
cssPipelineContext: ViteFrameworkCssPipelineContext;
|
|
5
|
+
cssPipelineStrategy?: ViteFrameworkCssPipelineStrategy | undefined;
|
|
6
|
+
isWebGeneratorTarget: boolean;
|
|
7
|
+
outputFile: string;
|
|
8
|
+
}): string | undefined;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { TailwindInlineSourceCandidates, TailwindSourceEntry } from '../../tailwindcss/source-scan';
|
|
2
|
+
import type { ICustomAttributesEntities } from '../../types';
|
|
2
3
|
import type { IArbitraryValues } from '../../types/shared';
|
|
3
4
|
export interface SourceCandidateStore {
|
|
4
5
|
syncSource: (id: string, source: string) => Promise<void>;
|
|
@@ -51,6 +52,8 @@ interface ScanSourceCandidateRootOptions {
|
|
|
51
52
|
}
|
|
52
53
|
export interface SourceCandidateCollectorOptions {
|
|
53
54
|
bareArbitraryValues?: IArbitraryValues['bareArbitraryValues'] | undefined;
|
|
55
|
+
customAttributesEntities?: ICustomAttributesEntities | undefined;
|
|
56
|
+
disabledDefaultTemplateHandler?: boolean | undefined;
|
|
54
57
|
extractor?: ((source: string, extension: string) => Promise<Iterable<string>> | Iterable<string>) | undefined;
|
|
55
58
|
}
|
|
56
59
|
export declare function isSourceCandidateRequest(id: string): boolean;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { resolveMpxPlatform } from "./framework.mjs";
|
|
2
|
-
import { Ft as resolveValidTailwindV4Candidates$1, Mt as resolveCssMacroTailwindV4Source, O as resolveBooleanObjectOption, Pt as loadTailwindV4DesignSystem, _t as createTailwindV4Engine$1, a as resolveGeneratorRuntimeBranch, d as resolveTailwindV4SourceFromRuntime, i as normalizeWeappTailwindcssGeneratorOptions } from "./generator-
|
|
3
|
-
import { c as getRuntimeClassSetCacheEntry, d as invalidateRuntimeClassSet, i as resolveUniAppXOptions, o as applyV4CssCalcDefaults, s as warnMissingCssEntries, t as createTailwindcssRuntimeFromContext, u as getRuntimeClassSetSignatureWithSources } from "./tailwindcss-
|
|
2
|
+
import { Ft as resolveValidTailwindV4Candidates$1, Mt as resolveCssMacroTailwindV4Source, O as resolveBooleanObjectOption, Pt as loadTailwindV4DesignSystem, _t as createTailwindV4Engine$1, a as resolveGeneratorRuntimeBranch, d as resolveTailwindV4SourceFromRuntime, i as normalizeWeappTailwindcssGeneratorOptions } from "./generator-B59OA64h.mjs";
|
|
3
|
+
import { c as getRuntimeClassSetCacheEntry, d as invalidateRuntimeClassSet, i as resolveUniAppXOptions, o as applyV4CssCalcDefaults, s as warnMissingCssEntries, t as createTailwindcssRuntimeFromContext, u as getRuntimeClassSetSignatureWithSources } from "./tailwindcss-DPcKMLxL.mjs";
|
|
4
4
|
import { i as isMap, n as defuOverrideArray } from "./utils-MVwpU07P.mjs";
|
|
5
5
|
import { b as md5Hash, d as jsStringEscape, h as shouldEnableArbitraryValueFallback, l as getReplacement, m as resolveClassNameTransformWithResult, o as jsHandler, p as decodeUnicode2, t as createTemplateHandler, u as getReplacementCacheStore, y as createDebug } from "./wxml-DdGdeqaH.mjs";
|
|
6
6
|
import { getDefaultOptions, resolveDefaultCssPreflight } from "./defaults.mjs";
|
|
@@ -1200,7 +1200,9 @@ function createInternalCompilerContext(opts) {
|
|
|
1200
1200
|
const cssCalcOptions = applyV4CssCalcDefaults(ctx.cssCalc, tailwindRuntime);
|
|
1201
1201
|
ctx.cssCalc = cssCalcOptions;
|
|
1202
1202
|
syncLegacyFieldsToCssOptions(ctx);
|
|
1203
|
-
const
|
|
1203
|
+
const customAttributesEntities = toCustomAttributesEntities(ctx.customAttributes);
|
|
1204
|
+
ctx.customAttributesEntities = customAttributesEntities;
|
|
1205
|
+
const { styleHandler, jsHandler, templateHandler } = createHandlersFromContext(ctx, customAttributesEntities, cssCalcOptions, tailwindRuntime.majorVersion);
|
|
1204
1206
|
ctx.styleHandler = styleHandler;
|
|
1205
1207
|
ctx.jsHandler = jsHandler;
|
|
1206
1208
|
ctx.templateHandler = templateHandler;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const require_rolldown_runtime = require("./rolldown-runtime-emK7D4bc.js");
|
|
2
2
|
const require_framework = require("./framework.js");
|
|
3
|
-
const require_generator = require("./generator-
|
|
4
|
-
const require_tailwindcss = require("./tailwindcss-
|
|
3
|
+
const require_generator = require("./generator-CEnUsjed.js");
|
|
4
|
+
const require_tailwindcss = require("./tailwindcss-KBYPJ2DW.js");
|
|
5
5
|
require("./utils-CuKLf1Zv.js");
|
|
6
6
|
const require_wxml = require("./wxml-Ce10eREX.js");
|
|
7
7
|
const require_defaults = require("./defaults.js");
|
|
@@ -1206,7 +1206,9 @@ function createInternalCompilerContext(opts) {
|
|
|
1206
1206
|
const cssCalcOptions = require_tailwindcss.applyV4CssCalcDefaults(ctx.cssCalc, tailwindRuntime);
|
|
1207
1207
|
ctx.cssCalc = cssCalcOptions;
|
|
1208
1208
|
syncLegacyFieldsToCssOptions(ctx);
|
|
1209
|
-
const
|
|
1209
|
+
const customAttributesEntities = toCustomAttributesEntities(ctx.customAttributes);
|
|
1210
|
+
ctx.customAttributesEntities = customAttributesEntities;
|
|
1211
|
+
const { styleHandler, jsHandler, templateHandler } = createHandlersFromContext(ctx, customAttributesEntities, cssCalcOptions, tailwindRuntime.majorVersion);
|
|
1210
1212
|
ctx.styleHandler = styleHandler;
|
|
1211
1213
|
ctx.jsHandler = jsHandler;
|
|
1212
1214
|
ctx.templateHandler = templateHandler;
|
package/dist/core.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_context = require("./context-
|
|
2
|
+
const require_context = require("./context-VeFq_8vW.js");
|
|
3
3
|
let _weapp_tailwindcss_shared = require("@weapp-tailwindcss/shared");
|
|
4
4
|
//#region src/core.ts
|
|
5
5
|
const DEFAULT_MAIN_CHUNK_STYLE_OPTIONS = Object.freeze({ isMainChunk: true });
|
package/dist/core.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { l as createTailwindRuntimeReadyPromise, o as shouldSkipJsTransform, t as getCompilerContext, u as ensureRuntimeClassSet } from "./context-
|
|
1
|
+
import { l as createTailwindRuntimeReadyPromise, o as shouldSkipJsTransform, t as getCompilerContext, u as ensureRuntimeClassSet } from "./context-BL8Gy71H.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 });
|
|
@@ -1343,7 +1343,7 @@ function normalizeConfigDirective(css, config) {
|
|
|
1343
1343
|
//#region src/bundlers/shared/generator-css/markers.ts
|
|
1344
1344
|
const TAILWIND_V4_BANNER_RE = /\/\*!\s*tailwindcss v4\./;
|
|
1345
1345
|
const TAILWIND_ESCAPED_UTILITY_MARKER_RE = /\.[^,{]{0,512}(?:\\:|\\\[|\\#)/;
|
|
1346
|
-
const TAILWIND_ROOT_THEME_MARKER_RE = /(?::host
|
|
1346
|
+
const TAILWIND_ROOT_THEME_MARKER_RE = /(?::root\s*,\s*:host|:host\s*,\s*page\s*,\s*\.tw-root\s*,\s*wx-root-portal-content)[^{]{0,256}\{[^}]{0,4096}(?:--spacing\b|--(?:color|text|font|default|radius)-)/;
|
|
1347
1347
|
const GENERATOR_PLACEHOLDER_MARKER_RE = /\/\*!\s*weapp-tailwindcss generator-placeholder\s*\*\//i;
|
|
1348
1348
|
const GENERATOR_PLACEHOLDER_MARKER_GLOBAL_RE = /\/\*!\s*weapp-tailwindcss generator-placeholder\s*\*\/\s*/gi;
|
|
1349
1349
|
const TAILWIND_BANNER_PREFIX_RE = /^\/\*!\s*tailwindcss v[^*]*\*\/\s*/i;
|
|
@@ -1409,7 +1409,7 @@ function hasTailwindGeneratedCss(rawSource) {
|
|
|
1409
1409
|
}
|
|
1410
1410
|
function hasTailwindGeneratedCssMarkers(rawSource) {
|
|
1411
1411
|
if (rawSource.includes("--tw-") || rawSource.includes("tailwindcss v") || rawSource.includes(":not(#\\#)") || GENERATOR_PLACEHOLDER_MARKER_RE.test(rawSource)) return true;
|
|
1412
|
-
if (!rawSource.includes("\\:") && !rawSource.includes("\\[") && !rawSource.includes("\\#") && !rawSource.includes("--color-") && !rawSource.includes("--spacing
|
|
1412
|
+
if (!rawSource.includes("\\:") && !rawSource.includes("\\[") && !rawSource.includes("\\#") && !rawSource.includes("--color-") && !rawSource.includes("--spacing") && !rawSource.includes("--text-") && !rawSource.includes("--font-") && !rawSource.includes("--font-weight-") && !rawSource.includes("--default-") && !rawSource.includes("--radius-")) return false;
|
|
1413
1413
|
return TAILWIND_ESCAPED_UTILITY_MARKER_RE.test(rawSource) || TAILWIND_ROOT_THEME_MARKER_RE.test(rawSource);
|
|
1414
1414
|
}
|
|
1415
1415
|
//#endregion
|
|
@@ -1834,8 +1834,22 @@ function removeTailwindV4GeneratorAtRulesFallback(source) {
|
|
|
1834
1834
|
function isTailwindGeneratedPreflightComment(text) {
|
|
1835
1835
|
return text.includes("cssremedy") || text.includes("Use the user's configured") || text.includes("tailwindlabs/tailwindcss") || text.includes("Prevent padding and border from affecting element width") || text.includes("Remove default margins and padding") || text.includes("Deprecated") || text.includes("Reset all borders") || text.includes("Add the correct text decoration") || text.includes("Make elements with the HTML hidden attribute stay hidden") || text.includes("Inherit font styles in all browsers") || text.includes("Add the correct height in Firefox") || text.includes("Remove the default font size and weight for headings") || text.includes("Reset links to optimize for opt-in styling") || text.includes("Add the correct font weight in Edge and Safari") || text.includes("Use the user's configured `mono` font-family") || text.includes("Add the correct font size in all browsers") || text.includes("Prevent `sub` and `sup` elements from affecting the line height") || text.includes("Remove text indentation from table contents") || text.includes("Use the modern Firefox focus style") || text.includes("Add the correct vertical alignment") || text.includes("Add the correct display") || text.includes("Make lists unstyled by default") || text.includes("Make replaced elements `display: block` by default") || text.includes("Constrain images and videos to the parent width") || text.includes("Restore default font weight") || text.includes("Restore indentation") || text.includes("Restore space after button") || text.includes("Prevent resizing textareas horizontally") || text.includes("Remove the inner padding in Chrome and Safari") || text.includes("Ensure date/time inputs have the same height") || text.includes("Prevent height from changing on date/time inputs") || text.includes("Remove excess padding from pseudo-elements") || text.includes("Center dropdown marker shown on inputs") || text.includes("Remove the additional `:invalid` styles") || text.includes("Correct the inability to style the border radius") || text.includes("Correct the cursor style of increment and decrement buttons");
|
|
1836
1836
|
}
|
|
1837
|
+
const TAILWIND_GENERATED_THEME_SCOPE_SELECTORS = /* @__PURE__ */ new Set([
|
|
1838
|
+
":host",
|
|
1839
|
+
":root",
|
|
1840
|
+
"page",
|
|
1841
|
+
".tw-root",
|
|
1842
|
+
"wx-root-portal-content"
|
|
1843
|
+
]);
|
|
1844
|
+
function isTailwindGeneratedThemeScopeSelector(selector) {
|
|
1845
|
+
const selectors = selector.split(",").map((item) => item.trim()).filter(Boolean);
|
|
1846
|
+
const selectorSet = new Set(selectors);
|
|
1847
|
+
if (selectorSet.size !== selectors.length) return false;
|
|
1848
|
+
if (!selectors.every((item) => TAILWIND_GENERATED_THEME_SCOPE_SELECTORS.has(item))) return false;
|
|
1849
|
+
return selectorSet.size === 2 && selectorSet.has(":root") && selectorSet.has(":host") || selectorSet.size === 4 && selectorSet.has(":host") && selectorSet.has("page") && selectorSet.has(".tw-root") && selectorSet.has("wx-root-portal-content");
|
|
1850
|
+
}
|
|
1837
1851
|
function isTailwindGeneratedThemeRule(selector, node) {
|
|
1838
|
-
if (
|
|
1852
|
+
if (!isTailwindGeneratedThemeScopeSelector(selector)) return false;
|
|
1839
1853
|
return node.nodes?.some((child) => child.type === "decl" && /^--(?:color|spacing|text|font|default|radius|tw-)/.test(child.prop)) ?? false;
|
|
1840
1854
|
}
|
|
1841
1855
|
function isTailwindGeneratedPreflightRule(selector, node) {
|
|
@@ -1348,7 +1348,7 @@ function normalizeConfigDirective(css, config) {
|
|
|
1348
1348
|
//#region src/bundlers/shared/generator-css/markers.ts
|
|
1349
1349
|
const TAILWIND_V4_BANNER_RE = /\/\*!\s*tailwindcss v4\./;
|
|
1350
1350
|
const TAILWIND_ESCAPED_UTILITY_MARKER_RE = /\.[^,{]{0,512}(?:\\:|\\\[|\\#)/;
|
|
1351
|
-
const TAILWIND_ROOT_THEME_MARKER_RE = /(?::host
|
|
1351
|
+
const TAILWIND_ROOT_THEME_MARKER_RE = /(?::root\s*,\s*:host|:host\s*,\s*page\s*,\s*\.tw-root\s*,\s*wx-root-portal-content)[^{]{0,256}\{[^}]{0,4096}(?:--spacing\b|--(?:color|text|font|default|radius)-)/;
|
|
1352
1352
|
const GENERATOR_PLACEHOLDER_MARKER_RE = /\/\*!\s*weapp-tailwindcss generator-placeholder\s*\*\//i;
|
|
1353
1353
|
const GENERATOR_PLACEHOLDER_MARKER_GLOBAL_RE = /\/\*!\s*weapp-tailwindcss generator-placeholder\s*\*\/\s*/gi;
|
|
1354
1354
|
const TAILWIND_BANNER_PREFIX_RE = /^\/\*!\s*tailwindcss v[^*]*\*\/\s*/i;
|
|
@@ -1414,7 +1414,7 @@ function hasTailwindGeneratedCss(rawSource) {
|
|
|
1414
1414
|
}
|
|
1415
1415
|
function hasTailwindGeneratedCssMarkers(rawSource) {
|
|
1416
1416
|
if (rawSource.includes("--tw-") || rawSource.includes("tailwindcss v") || rawSource.includes(":not(#\\#)") || GENERATOR_PLACEHOLDER_MARKER_RE.test(rawSource)) return true;
|
|
1417
|
-
if (!rawSource.includes("\\:") && !rawSource.includes("\\[") && !rawSource.includes("\\#") && !rawSource.includes("--color-") && !rawSource.includes("--spacing
|
|
1417
|
+
if (!rawSource.includes("\\:") && !rawSource.includes("\\[") && !rawSource.includes("\\#") && !rawSource.includes("--color-") && !rawSource.includes("--spacing") && !rawSource.includes("--text-") && !rawSource.includes("--font-") && !rawSource.includes("--font-weight-") && !rawSource.includes("--default-") && !rawSource.includes("--radius-")) return false;
|
|
1418
1418
|
return TAILWIND_ESCAPED_UTILITY_MARKER_RE.test(rawSource) || TAILWIND_ROOT_THEME_MARKER_RE.test(rawSource);
|
|
1419
1419
|
}
|
|
1420
1420
|
//#endregion
|
|
@@ -1839,8 +1839,22 @@ function removeTailwindV4GeneratorAtRulesFallback(source) {
|
|
|
1839
1839
|
function isTailwindGeneratedPreflightComment(text) {
|
|
1840
1840
|
return text.includes("cssremedy") || text.includes("Use the user's configured") || text.includes("tailwindlabs/tailwindcss") || text.includes("Prevent padding and border from affecting element width") || text.includes("Remove default margins and padding") || text.includes("Deprecated") || text.includes("Reset all borders") || text.includes("Add the correct text decoration") || text.includes("Make elements with the HTML hidden attribute stay hidden") || text.includes("Inherit font styles in all browsers") || text.includes("Add the correct height in Firefox") || text.includes("Remove the default font size and weight for headings") || text.includes("Reset links to optimize for opt-in styling") || text.includes("Add the correct font weight in Edge and Safari") || text.includes("Use the user's configured `mono` font-family") || text.includes("Add the correct font size in all browsers") || text.includes("Prevent `sub` and `sup` elements from affecting the line height") || text.includes("Remove text indentation from table contents") || text.includes("Use the modern Firefox focus style") || text.includes("Add the correct vertical alignment") || text.includes("Add the correct display") || text.includes("Make lists unstyled by default") || text.includes("Make replaced elements `display: block` by default") || text.includes("Constrain images and videos to the parent width") || text.includes("Restore default font weight") || text.includes("Restore indentation") || text.includes("Restore space after button") || text.includes("Prevent resizing textareas horizontally") || text.includes("Remove the inner padding in Chrome and Safari") || text.includes("Ensure date/time inputs have the same height") || text.includes("Prevent height from changing on date/time inputs") || text.includes("Remove excess padding from pseudo-elements") || text.includes("Center dropdown marker shown on inputs") || text.includes("Remove the additional `:invalid` styles") || text.includes("Correct the inability to style the border radius") || text.includes("Correct the cursor style of increment and decrement buttons");
|
|
1841
1841
|
}
|
|
1842
|
+
const TAILWIND_GENERATED_THEME_SCOPE_SELECTORS = /* @__PURE__ */ new Set([
|
|
1843
|
+
":host",
|
|
1844
|
+
":root",
|
|
1845
|
+
"page",
|
|
1846
|
+
".tw-root",
|
|
1847
|
+
"wx-root-portal-content"
|
|
1848
|
+
]);
|
|
1849
|
+
function isTailwindGeneratedThemeScopeSelector(selector) {
|
|
1850
|
+
const selectors = selector.split(",").map((item) => item.trim()).filter(Boolean);
|
|
1851
|
+
const selectorSet = new Set(selectors);
|
|
1852
|
+
if (selectorSet.size !== selectors.length) return false;
|
|
1853
|
+
if (!selectors.every((item) => TAILWIND_GENERATED_THEME_SCOPE_SELECTORS.has(item))) return false;
|
|
1854
|
+
return selectorSet.size === 2 && selectorSet.has(":root") && selectorSet.has(":host") || selectorSet.size === 4 && selectorSet.has(":host") && selectorSet.has("page") && selectorSet.has(".tw-root") && selectorSet.has("wx-root-portal-content");
|
|
1855
|
+
}
|
|
1842
1856
|
function isTailwindGeneratedThemeRule(selector, node) {
|
|
1843
|
-
if (
|
|
1857
|
+
if (!isTailwindGeneratedThemeScopeSelector(selector)) return false;
|
|
1844
1858
|
return node.nodes?.some((child) => child.type === "decl" && /^--(?:color|spacing|text|font|default|radius|tw-)/.test(child.prop)) ?? false;
|
|
1845
1859
|
}
|
|
1846
1860
|
function isTailwindGeneratedPreflightRule(selector, node) {
|
package/dist/generator.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_generator = require("./generator-
|
|
2
|
+
const require_generator = require("./generator-CEnUsjed.js");
|
|
3
3
|
exports.createWeappTailwindcssGenerator = require_generator.createWeappTailwindcssGenerator;
|
|
4
4
|
exports.createWeappTailwindcssGeneratorFromRuntime = require_generator.createWeappTailwindcssGeneratorFromRuntime;
|
|
5
5
|
exports.normalizeWeappTailwindcssGeneratorOptions = require_generator.normalizeWeappTailwindcssGeneratorOptions;
|
package/dist/generator.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { bt as transformTailwindV4CssToWeapp, d as resolveTailwindV4SourceFromRuntime, f as resolveTailwindV4SourceFromRuntimeOptions, i as normalizeWeappTailwindcssGeneratorOptions, n as createWeappTailwindcssGeneratorFromRuntime, p as resolveTailwindV4SourceOptionsFromRuntime, r as resolveTailwindSourceFromRuntime, t as createWeappTailwindcssGenerator, u as resolveTailwindV4Source, yt as transformTailwindV4CssByTarget } from "./generator-
|
|
1
|
+
import { bt as transformTailwindV4CssToWeapp, d as resolveTailwindV4SourceFromRuntime, f as resolveTailwindV4SourceFromRuntimeOptions, i as normalizeWeappTailwindcssGeneratorOptions, n as createWeappTailwindcssGeneratorFromRuntime, p as resolveTailwindV4SourceOptionsFromRuntime, r as resolveTailwindSourceFromRuntime, t as createWeappTailwindcssGenerator, u as resolveTailwindV4Source, yt as transformTailwindV4CssByTarget } from "./generator-B59OA64h.mjs";
|
|
2
2
|
export { createWeappTailwindcssGenerator, createWeappTailwindcssGeneratorFromRuntime, normalizeWeappTailwindcssGeneratorOptions, resolveTailwindSourceFromRuntime, resolveTailwindV4Source, resolveTailwindV4SourceFromRuntime, resolveTailwindV4SourceFromRuntimeOptions, resolveTailwindV4SourceOptionsFromRuntime, transformTailwindV4CssByTarget, transformTailwindV4CssToWeapp };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
const require_rolldown_runtime = require("./rolldown-runtime-emK7D4bc.js");
|
|
2
|
-
const require_generator = require("./generator-
|
|
3
|
-
const require_tailwindcss = require("./tailwindcss-
|
|
2
|
+
const require_generator = require("./generator-CEnUsjed.js");
|
|
3
|
+
const require_tailwindcss = require("./tailwindcss-KBYPJ2DW.js");
|
|
4
4
|
const require_wxml = require("./wxml-Ce10eREX.js");
|
|
5
|
-
const require_context = require("./context-
|
|
6
|
-
const require_hmr_timing = require("./hmr-timing-
|
|
5
|
+
const require_context = require("./context-VeFq_8vW.js");
|
|
6
|
+
const require_hmr_timing = require("./hmr-timing-BZ5sWIqO.js");
|
|
7
7
|
let node_fs = require("node:fs");
|
|
8
8
|
node_fs = require_rolldown_runtime.__toESM(node_fs);
|
|
9
9
|
let node_path = require("node:path");
|
|
@@ -288,7 +288,11 @@ function createNativeGulpPlugins(options = {}) {
|
|
|
288
288
|
dependencies: [...sourceScan?.dependencies ?? []].sort()
|
|
289
289
|
}));
|
|
290
290
|
if (!forceRefresh && cachedGulpSourceCandidateSignature === nextSignature && cachedGulpSourceCandidateGetter) return cachedGulpSourceCandidateGetter;
|
|
291
|
-
const collector = require_hmr_timing.createSourceCandidateCollector({
|
|
291
|
+
const collector = require_hmr_timing.createSourceCandidateCollector({
|
|
292
|
+
bareArbitraryValues: opts.arbitraryValues?.bareArbitraryValues,
|
|
293
|
+
customAttributesEntities: opts.customAttributesEntities,
|
|
294
|
+
disabledDefaultTemplateHandler: opts.disabledDefaultTemplateHandler
|
|
295
|
+
});
|
|
292
296
|
await collector.scanRoot({
|
|
293
297
|
entries: sourceScan?.entries,
|
|
294
298
|
explicit: sourceScan?.explicit,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { Q as normalizeTailwindConfigDirectives, X as hasTailwindRootDirectives, et as normalizeTailwindSourceForGenerator, g as upsertTailwindV4CssSource, gt as prependConfigDirective, h as hasConfiguredTailwindV4CssRoots, vt as getTailwindV4IncrementalGenerateCacheStats } from "./generator-
|
|
2
|
-
import { l as getRuntimeClassSetSignature, p as resolveViteSourceScanEntries } from "./tailwindcss-
|
|
1
|
+
import { Q as normalizeTailwindConfigDirectives, X as hasTailwindRootDirectives, et as normalizeTailwindSourceForGenerator, g as upsertTailwindV4CssSource, gt as prependConfigDirective, h as hasConfiguredTailwindV4CssRoots, vt as getTailwindV4IncrementalGenerateCacheStats } from "./generator-B59OA64h.mjs";
|
|
2
|
+
import { l as getRuntimeClassSetSignature, p as resolveViteSourceScanEntries } from "./tailwindcss-DPcKMLxL.mjs";
|
|
3
3
|
import { y as createDebug } from "./wxml-DdGdeqaH.mjs";
|
|
4
|
-
import { l as createTailwindRuntimeReadyPromise, n as normalizeStyleHandlerMajorVersion, o as shouldSkipJsTransform, t as getCompilerContext, u as ensureRuntimeClassSet } from "./context-
|
|
5
|
-
import { A as processCachedTask, D as createCssSourceTraceCacheSignature, E as annotateCssSourceTrace, O as createCssTokenSourceMap, b as rewriteLocalCssImportRequestsForOutput, n as emitHmrTiming, r as createSourceCandidateCollector, s as createBundleRuntimeClassSetManager, u as generateCssByGenerator, x as splitLocalCssImports } from "./hmr-timing-
|
|
4
|
+
import { l as createTailwindRuntimeReadyPromise, n as normalizeStyleHandlerMajorVersion, o as shouldSkipJsTransform, t as getCompilerContext, u as ensureRuntimeClassSet } from "./context-BL8Gy71H.mjs";
|
|
5
|
+
import { A as processCachedTask, D as createCssSourceTraceCacheSignature, E as annotateCssSourceTrace, O as createCssTokenSourceMap, b as rewriteLocalCssImportRequestsForOutput, n as emitHmrTiming, r as createSourceCandidateCollector, s as createBundleRuntimeClassSetManager, u as generateCssByGenerator, x as splitLocalCssImports } from "./hmr-timing-C3ed5vCx.mjs";
|
|
6
6
|
import fs from "node:fs";
|
|
7
7
|
import path from "node:path";
|
|
8
8
|
import process from "node:process";
|
|
@@ -282,7 +282,11 @@ function createNativeGulpPlugins(options = {}) {
|
|
|
282
282
|
dependencies: [...sourceScan?.dependencies ?? []].sort()
|
|
283
283
|
}));
|
|
284
284
|
if (!forceRefresh && cachedGulpSourceCandidateSignature === nextSignature && cachedGulpSourceCandidateGetter) return cachedGulpSourceCandidateGetter;
|
|
285
|
-
const collector = createSourceCandidateCollector({
|
|
285
|
+
const collector = createSourceCandidateCollector({
|
|
286
|
+
bareArbitraryValues: opts.arbitraryValues?.bareArbitraryValues,
|
|
287
|
+
customAttributesEntities: opts.customAttributesEntities,
|
|
288
|
+
disabledDefaultTemplateHandler: opts.disabledDefaultTemplateHandler
|
|
289
|
+
});
|
|
286
290
|
await collector.scanRoot({
|
|
287
291
|
entries: sourceScan?.entries,
|
|
288
292
|
explicit: sourceScan?.explicit,
|
package/dist/gulp.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_gulp = require("./gulp-
|
|
2
|
+
const require_gulp = require("./gulp-C1Q3LRzg.js");
|
|
3
3
|
exports.WeappTailwindcss = require_gulp.createPlugins;
|
|
4
4
|
exports.createPlugins = require_gulp.createPlugins;
|
|
5
5
|
exports.weappTailwindcss = require_gulp.createPlugins;
|
package/dist/gulp.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as createPlugins } from "./gulp-
|
|
1
|
+
import { t as createPlugins } from "./gulp-DUYWxmZC.mjs";
|
|
2
2
|
export { createPlugins as WeappTailwindcss, createPlugins, createPlugins as weappTailwindcss };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
const require_rolldown_runtime = require("./rolldown-runtime-emK7D4bc.js");
|
|
2
|
-
const require_generator = require("./generator-
|
|
2
|
+
const require_generator = require("./generator-CEnUsjed.js");
|
|
3
3
|
const require_object = require("./object-COs_Mw6p.js");
|
|
4
|
-
const require_tailwindcss = require("./tailwindcss-
|
|
4
|
+
const require_tailwindcss = require("./tailwindcss-KBYPJ2DW.js");
|
|
5
5
|
const require_wxml = require("./wxml-Ce10eREX.js");
|
|
6
|
-
const require_context = require("./context-
|
|
6
|
+
const require_context = require("./context-VeFq_8vW.js");
|
|
7
7
|
let node_fs = require("node:fs");
|
|
8
8
|
let node_path = require("node:path");
|
|
9
9
|
node_path = require_rolldown_runtime.__toESM(node_path);
|
|
@@ -1476,7 +1476,8 @@ async function resolveGeneratorSource(_majorVersion, runtimeState, rawSource, fi
|
|
|
1476
1476
|
index: 0,
|
|
1477
1477
|
matched: true
|
|
1478
1478
|
}) : void 0;
|
|
1479
|
-
const
|
|
1479
|
+
const canResolveCombinedConfiguredCssSources = (normalizedSourceOptions?.cssSources?.length ?? 0) <= 1 || require_generator.hasTailwindGeneratedCss(rawSource);
|
|
1480
|
+
const configuredCssSource = normalizedSourceOptions && hasConfiguredTailwindV4CssSource(normalizedSourceOptions) && require_generator.hasTailwindGeneratedCssMarkers(rawSource) ? matchedCssSource ?? candidateMatchedCssSource ?? singleConfiguredCssSource ?? (canResolveCombinedConfiguredCssSources ? await require_generator.resolveTailwindV4Source(normalizedSourceOptions) : void 0) : void 0;
|
|
1480
1481
|
if (configuredCssSource) return generatorOptions?.config ? {
|
|
1481
1482
|
...configuredCssSource,
|
|
1482
1483
|
css: require_generator.prependConfigDirective(configuredCssSource.css, generatorOptions.config)
|
|
@@ -2468,6 +2469,8 @@ async function generateCssByGenerator(options) {
|
|
|
2468
2469
|
}
|
|
2469
2470
|
debug("tailwind direct css generation prefix mismatch, append transformed bundle css %s", file);
|
|
2470
2471
|
let css = generatedCss;
|
|
2472
|
+
const distinctUserLayerParts = hasDistinctUserRawSource && require_generator.hasUserCssLayerBlocks(generatedUserCssRawSource) ? require_generator.splitUserCssLayerBlocks(generatedUserCssRawSource) : void 0;
|
|
2473
|
+
let restoredDistinctUserLayerCss = false;
|
|
2471
2474
|
if (generated.target === "weapp" && generatorRawSource.includes("weapp-tailwindcss generator-placeholder") && !require_generator.hasUserCssLayerBlocks(generatorRawSource)) css = createCssSourceOrderAppend$1(await require_generator.transformGeneratorUserCss(generatedUserCssRawSource, {
|
|
2472
2475
|
generatorTarget: generated.target,
|
|
2473
2476
|
generatorStyleOptions,
|
|
@@ -2497,10 +2500,26 @@ async function generateCssByGenerator(options) {
|
|
|
2497
2500
|
if (shouldFinalizeMarkedUserLayerComponentsCss(file)) css = reorderMarkedUserLayerComponentsCss(css);
|
|
2498
2501
|
}
|
|
2499
2502
|
}
|
|
2503
|
+
if (hasDistinctUserRawSource && distinctUserLayerParts) {
|
|
2504
|
+
const layerUserCss = await require_generator.transformGeneratorUserCss(distinctUserLayerParts.layer, {
|
|
2505
|
+
generatorTarget: generated.target,
|
|
2506
|
+
generatorStyleOptions,
|
|
2507
|
+
cssUserHandlerOptions,
|
|
2508
|
+
styleHandler,
|
|
2509
|
+
importFallback: generatorOptions.importFallback,
|
|
2510
|
+
processed: userRawSourceProcessed
|
|
2511
|
+
});
|
|
2512
|
+
if ((0, _weapp_tailwindcss_postcss.filterExistingCssRules)(css, layerUserCss).trim().length > 0) {
|
|
2513
|
+
css = createCssSourceOrderAppend$1(wrapUserLayerComponentsCss(layerUserCss), css);
|
|
2514
|
+
restoredDistinctUserLayerCss = true;
|
|
2515
|
+
if (shouldFinalizeMarkedUserLayerComponentsCss(file)) css = reorderMarkedUserLayerComponentsCss(css);
|
|
2516
|
+
}
|
|
2517
|
+
}
|
|
2500
2518
|
}
|
|
2501
2519
|
if (hasMatchedCssSourceFile || generated.target === "web") {
|
|
2502
2520
|
if (generated.target === "weapp" && !hasGeneratedCss && !hasGeneratedMarkers) {
|
|
2503
|
-
const
|
|
2521
|
+
const distinctUserCssRawSource = restoredDistinctUserLayerCss ? distinctUserLayerParts?.rest ?? generatedUserCssRawSource : generatedUserCssRawSource;
|
|
2522
|
+
const userCss = await require_generator.transformGeneratorUserCss(distinctUserCssRawSource, {
|
|
2504
2523
|
generatorTarget: generated.target,
|
|
2505
2524
|
generatorStyleOptions,
|
|
2506
2525
|
cssUserHandlerOptions,
|
|
@@ -2508,10 +2527,11 @@ async function generateCssByGenerator(options) {
|
|
|
2508
2527
|
importFallback: generatorOptions.importFallback,
|
|
2509
2528
|
processed: userRawSourceProcessed
|
|
2510
2529
|
});
|
|
2511
|
-
const missingUserCss = isCssAlreadyRepresentedByMarkers(css,
|
|
2530
|
+
const missingUserCss = isCssAlreadyRepresentedByMarkers(css, distinctUserCssRawSource) ? (0, _weapp_tailwindcss_postcss.filterExistingCssRules)(css, userCss) : userCss;
|
|
2512
2531
|
css = createCssSourceOrderAppend$1(css, missingUserCss);
|
|
2513
2532
|
} else if (hasMatchedCssSourceFile && generated.target === "weapp" && hasGeneratedMarkers && !hasGeneratedCss) {
|
|
2514
|
-
const
|
|
2533
|
+
const cleanedUserCssRawSource = require_generator.removeTailwindV4GeneratedUserCssArtifacts(userCssRawSource);
|
|
2534
|
+
const userCss = await require_generator.transformGeneratorUserCss(restoredDistinctUserLayerCss && require_generator.hasUserCssLayerBlocks(cleanedUserCssRawSource) ? require_generator.splitUserCssLayerBlocks(cleanedUserCssRawSource).rest : cleanedUserCssRawSource, {
|
|
2515
2535
|
generatorTarget: generated.target,
|
|
2516
2536
|
generatorStyleOptions,
|
|
2517
2537
|
cssUserHandlerOptions,
|
|
@@ -2576,7 +2596,8 @@ async function generateCssByGenerator(options) {
|
|
|
2576
2596
|
css = await appendLegacyContainerCompatCss(css, generatedUserCssRawSource, file, runtime, configuredContainerCompat, generated.target, styleHandler, cssHandlerOptions, generatorStyleOptions);
|
|
2577
2597
|
}
|
|
2578
2598
|
if (generated.target === "weapp" && hasDistinctUserRawSource && !hasGeneratedCss && !hasGeneratedMarkers && !require_generator.hasTailwindApplyDirective(generatedUserCssRawSource)) {
|
|
2579
|
-
const
|
|
2599
|
+
const distinctUserCssRawSource = restoredDistinctUserLayerCss ? distinctUserLayerParts?.rest ?? generatedUserCssRawSource : generatedUserCssRawSource;
|
|
2600
|
+
const userCss = await require_generator.transformGeneratorUserCss(distinctUserCssRawSource, {
|
|
2580
2601
|
generatorTarget: generated.target,
|
|
2581
2602
|
generatorStyleOptions,
|
|
2582
2603
|
cssUserHandlerOptions,
|
|
@@ -2584,7 +2605,7 @@ async function generateCssByGenerator(options) {
|
|
|
2584
2605
|
importFallback: generatorOptions.importFallback,
|
|
2585
2606
|
processed: userRawSourceProcessed
|
|
2586
2607
|
});
|
|
2587
|
-
const missingUserCss = isCssAlreadyRepresentedByMarkers(css,
|
|
2608
|
+
const missingUserCss = isCssAlreadyRepresentedByMarkers(css, distinctUserCssRawSource) ? (0, _weapp_tailwindcss_postcss.filterExistingCssRules)(css, userCss) : userCss;
|
|
2588
2609
|
css = createCssSourceOrderAppend$1(css, missingUserCss);
|
|
2589
2610
|
}
|
|
2590
2611
|
const finalCss = finalizeGeneratorCss(css, generated.target, {
|
|
@@ -2893,10 +2914,66 @@ const SCRIPT_SOURCE_CANDIDATE_EXTENSIONS = /* @__PURE__ */ new Set([
|
|
|
2893
2914
|
"mts",
|
|
2894
2915
|
"cts"
|
|
2895
2916
|
]);
|
|
2917
|
+
const TEMPLATE_SOURCE_CANDIDATE_EXTENSIONS = /* @__PURE__ */ new Set([
|
|
2918
|
+
"html",
|
|
2919
|
+
"wxml",
|
|
2920
|
+
"axml",
|
|
2921
|
+
"jxml",
|
|
2922
|
+
"ksml",
|
|
2923
|
+
"ttml",
|
|
2924
|
+
"qml",
|
|
2925
|
+
"tyml",
|
|
2926
|
+
"xhsml",
|
|
2927
|
+
"swan",
|
|
2928
|
+
"vue",
|
|
2929
|
+
"uvue",
|
|
2930
|
+
"nvue",
|
|
2931
|
+
"mpx"
|
|
2932
|
+
]);
|
|
2896
2933
|
async function extractCandidatesFromSource(source, extension, options = {}) {
|
|
2897
2934
|
const candidates = options.extractor ? new Set(await options.extractor(source, extension)) : new Set(await (0, _tailwindcss_mangle_engine.extractSourceCandidates)(source, extension, { ...options.bareArbitraryValues === void 0 ? {} : { bareArbitraryValues: options.bareArbitraryValues } }));
|
|
2898
2935
|
const scriptCandidates = await extractScriptStringCandidates(source, extension, options);
|
|
2899
2936
|
for (const candidate of scriptCandidates) candidates.add(candidate);
|
|
2937
|
+
const templateAttributeCandidates = await extractTemplateAttributeCandidates(source, extension, options);
|
|
2938
|
+
for (const candidate of templateAttributeCandidates) candidates.add(candidate);
|
|
2939
|
+
return candidates;
|
|
2940
|
+
}
|
|
2941
|
+
function isDefaultTemplateAttribute(name) {
|
|
2942
|
+
if (name === "class" || name === "hover-class" || name === "virtualhostclass") return true;
|
|
2943
|
+
const lowerName = name.toLowerCase();
|
|
2944
|
+
return lowerName === "class" || lowerName === "hover-class" || lowerName === "virtualhostclass";
|
|
2945
|
+
}
|
|
2946
|
+
async function extractCandidateTokensFromTemplateAttributeValue(value, options) {
|
|
2947
|
+
return options.extractor ? await options.extractor(value, "html") : await (0, _tailwindcss_mangle_engine.extractSourceCandidates)(value, "html", { ...options.bareArbitraryValues === void 0 ? {} : { bareArbitraryValues: options.bareArbitraryValues } });
|
|
2948
|
+
}
|
|
2949
|
+
async function extractTemplateAttributeCandidates(source, extension, options) {
|
|
2950
|
+
if (!TEMPLATE_SOURCE_CANDIDATE_EXTENSIONS.has(extension)) return [];
|
|
2951
|
+
if (!options.customAttributesEntities?.length) return [];
|
|
2952
|
+
const candidates = /* @__PURE__ */ new Set();
|
|
2953
|
+
const matchCustomAttribute = require_wxml.createAttributeMatcher(options.customAttributesEntities);
|
|
2954
|
+
const defaultTemplateHandlerEnabled = !options.disabledDefaultTemplateHandler;
|
|
2955
|
+
let tag = "";
|
|
2956
|
+
const tasks = [];
|
|
2957
|
+
const parser = new require_wxml.Parser({
|
|
2958
|
+
onopentagname(name) {
|
|
2959
|
+
tag = name;
|
|
2960
|
+
},
|
|
2961
|
+
onattribute(name, value) {
|
|
2962
|
+
if (!value) return;
|
|
2963
|
+
const shouldHandleDefault = defaultTemplateHandlerEnabled && isDefaultTemplateAttribute(name);
|
|
2964
|
+
const shouldHandleCustom = matchCustomAttribute?.(tag, name) ?? false;
|
|
2965
|
+
if (!shouldHandleDefault && !shouldHandleCustom) return;
|
|
2966
|
+
tasks.push((async () => {
|
|
2967
|
+
for (const candidate of await extractCandidateTokensFromTemplateAttributeValue(value, options)) candidates.add(candidate);
|
|
2968
|
+
})());
|
|
2969
|
+
},
|
|
2970
|
+
onclosetag() {
|
|
2971
|
+
tag = "";
|
|
2972
|
+
}
|
|
2973
|
+
}, { xmlMode: true });
|
|
2974
|
+
parser.write(source);
|
|
2975
|
+
parser.end();
|
|
2976
|
+
await Promise.all(tasks);
|
|
2900
2977
|
return candidates;
|
|
2901
2978
|
}
|
|
2902
2979
|
async function extractScriptStringCandidates(source, extension, options) {
|
|
@@ -3046,8 +3123,21 @@ function resolveSourceCandidateExtension(id) {
|
|
|
3046
3123
|
const normalized = cleanUrl(id);
|
|
3047
3124
|
return /\.([^.\\/]+)$/.exec(normalized)?.[1] ?? "html";
|
|
3048
3125
|
}
|
|
3049
|
-
function createSourceCandidateContentCacheKey(extension, source, bareArbitraryValues, extractor) {
|
|
3050
|
-
return
|
|
3126
|
+
function createSourceCandidateContentCacheKey(extension, source, bareArbitraryValues, customAttributesEntities, disabledDefaultTemplateHandler, extractor) {
|
|
3127
|
+
return [
|
|
3128
|
+
extension,
|
|
3129
|
+
JSON.stringify(bareArbitraryValues ?? false),
|
|
3130
|
+
createCustomAttributesCacheSignature(customAttributesEntities),
|
|
3131
|
+
disabledDefaultTemplateHandler === true ? "default-template:off" : "default-template:on",
|
|
3132
|
+
extractor ? "custom" : "default",
|
|
3133
|
+
(0, _weapp_tailwindcss_shared_node.md5)(source)
|
|
3134
|
+
].join("\0");
|
|
3135
|
+
}
|
|
3136
|
+
function createCustomAttributesCacheSignature(customAttributesEntities) {
|
|
3137
|
+
return JSON.stringify((customAttributesEntities ?? []).map(([selector, props]) => [stringifyCustomAttributeToken(selector), Array.isArray(props) ? props.map(stringifyCustomAttributeToken) : stringifyCustomAttributeToken(props)]));
|
|
3138
|
+
}
|
|
3139
|
+
function stringifyCustomAttributeToken(token) {
|
|
3140
|
+
return typeof token === "string" ? `s:${token}` : `r:${token.source}/${token.flags}`;
|
|
3051
3141
|
}
|
|
3052
3142
|
async function extractCandidates(source, extension, options) {
|
|
3053
3143
|
return extractCandidatesFromSource(source, extension, options);
|
|
@@ -3094,7 +3184,7 @@ function createSourceCandidateStore(options = {}) {
|
|
|
3094
3184
|
const normalizedId = cleanUrl(id);
|
|
3095
3185
|
scanSourceById.set(normalizedId, source);
|
|
3096
3186
|
const extension = resolveSourceCandidateExtension(normalizedId);
|
|
3097
|
-
const contentCacheKey = createSourceCandidateContentCacheKey(extension, source, options.bareArbitraryValues, options.extractor);
|
|
3187
|
+
const contentCacheKey = createSourceCandidateContentCacheKey(extension, source, options.bareArbitraryValues, options.customAttributesEntities, options.disabledDefaultTemplateHandler, options.extractor);
|
|
3098
3188
|
const cachedCandidates = sourceCandidateContentCache.get(contentCacheKey);
|
|
3099
3189
|
if (cachedCandidates) {
|
|
3100
3190
|
replaceScanLayer(normalizedId, new Set(cachedCandidates));
|
|
@@ -3107,7 +3197,7 @@ function createSourceCandidateStore(options = {}) {
|
|
|
3107
3197
|
async function syncCss(id, source) {
|
|
3108
3198
|
const normalizedId = cleanUrl(id);
|
|
3109
3199
|
cssSourceById.set(normalizedId, source);
|
|
3110
|
-
const contentCacheKey = createSourceCandidateContentCacheKey("css", source, options.bareArbitraryValues, options.extractor);
|
|
3200
|
+
const contentCacheKey = createSourceCandidateContentCacheKey("css", source, options.bareArbitraryValues, options.customAttributesEntities, options.disabledDefaultTemplateHandler, options.extractor);
|
|
3111
3201
|
const cachedCandidates = sourceCandidateContentCache.get(contentCacheKey);
|
|
3112
3202
|
if (cachedCandidates) {
|
|
3113
3203
|
replaceCssLayer(normalizedId, new Set(cachedCandidates));
|
|
@@ -3121,7 +3211,7 @@ function createSourceCandidateStore(options = {}) {
|
|
|
3121
3211
|
const normalizedId = cleanUrl(id);
|
|
3122
3212
|
transformSourceById.set(normalizedId, source);
|
|
3123
3213
|
const extension = resolveSourceCandidateExtension(normalizedId);
|
|
3124
|
-
const contentCacheKey = createSourceCandidateContentCacheKey(extension, source, options.bareArbitraryValues, options.extractor);
|
|
3214
|
+
const contentCacheKey = createSourceCandidateContentCacheKey(extension, source, options.bareArbitraryValues, options.customAttributesEntities, options.disabledDefaultTemplateHandler, options.extractor);
|
|
3125
3215
|
const cachedCandidates = sourceCandidateContentCache.get(contentCacheKey);
|
|
3126
3216
|
const extractedCandidates = cachedCandidates ? new Set(cachedCandidates) : await extractCandidates(source, extension, options);
|
|
3127
3217
|
if (!cachedCandidates) sourceCandidateContentCache.set(contentCacheKey, [...extractedCandidates]);
|