weapp-tailwindcss 5.1.14 → 5.1.15
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-2dg_uhEJ.mjs +13 -0
- package/dist/bundlers/gulp/frameworks/native/index.d.ts +2 -0
- package/dist/bundlers/gulp/index.d.ts +2 -0
- package/dist/bundlers/gulp/shared/create-native-framework-plugins.d.ts +2 -0
- package/dist/bundlers/shared/generated-css-marker.d.ts +2 -2
- package/dist/bundlers/shared/generator-css/local-imports.d.ts +1 -1
- package/dist/bundlers/shared/generator-css/source-resolver/postcss-source.d.ts +2 -0
- package/dist/bundlers/shared/generator-css/types.d.ts +5 -0
- package/dist/bundlers/shared/style-requests.d.ts +1 -0
- package/dist/bundlers/vite/bundle-state.d.ts +1 -0
- package/dist/bundlers/vite/generate-bundle/bundle-markup-candidates.d.ts +20 -0
- package/dist/bundlers/vite/generate-bundle/css-handler-options.d.ts +1 -0
- package/dist/bundlers/vite/generate-bundle/remembered-css-replay.d.ts +1 -0
- package/dist/bundlers/vite/generate-bundle/sfc-style-source.d.ts +2 -1
- package/dist/bundlers/vite/generate-bundle/source-candidate-source.d.ts +1 -0
- package/dist/bundlers/vite/generate-bundle/types.d.ts +5 -0
- package/dist/bundlers/vite/serve-css-generation.d.ts +3 -2
- package/dist/bundlers/vite/shared/create-framework-plugins.d.ts +1 -0
- package/dist/bundlers/vite/watch-css-post.d.ts +10 -0
- package/dist/bundlers/webpack/BaseUnifiedPlugin/shared.d.ts +6 -0
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets/css-source-resolvers.d.ts +1 -0
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets/pipeline-helpers.d.ts +2 -0
- package/dist/bundlers/webpack/loaders/runtime-registry.d.ts +1 -0
- package/dist/bundlers/webpack/loaders/weapp-tw-css-generation-loader.d.ts +4 -0
- package/dist/bundlers/webpack/loaders/weapp-tw-css-import-rewrite-loader.d.ts +3 -0
- package/dist/{context-BL8Gy71H.mjs → context-BgGWVAmN.mjs} +2 -2
- package/dist/core.mjs +1 -1
- package/dist/css-macro.mjs +1 -1
- package/dist/{generator-B59OA64h.mjs → generator-CEo920So.mjs} +1 -1
- package/dist/generator.mjs +1 -1
- package/dist/{gulp-C1Q3LRzg.js → gulp-3m1dAiig.js} +84 -50
- package/dist/{gulp-DUYWxmZC.mjs → gulp-DP71z1jG.mjs} +87 -53
- package/dist/gulp.js +1 -1
- package/dist/gulp.mjs +1 -1
- package/dist/{hmr-timing-C3ed5vCx.mjs → hmr-timing-1aS6--U7.mjs} +170 -44
- package/dist/{hmr-timing-BZ5sWIqO.js → hmr-timing-B8p4f0ca.js} +219 -39
- package/dist/index.js +3 -3
- package/dist/index.mjs +4 -4
- package/dist/postcss.mjs +1 -1
- package/dist/presets.mjs +1 -1
- package/dist/rspack.js +1 -1
- package/dist/rspack.mjs +1 -1
- package/dist/shared/mpx.d.ts +4 -1
- package/dist/{source-candidate-scan-signature-R3dzamcm.js → source-candidate-scan-signature-BAahhiwb.js} +4 -96
- package/dist/{source-candidate-scan-signature-D7RWjWsY.mjs → source-candidate-scan-signature-Cf7259PR.mjs} +6 -62
- package/dist/{tailwindcss-DPcKMLxL.mjs → tailwindcss-xs704TRw.mjs} +1 -1
- package/dist/{transform-D5JUgMpE.mjs → transform-B_KM9sLX.mjs} +47 -5
- package/dist/{transform-COFRlmDF.js → transform-CcYptivi.js} +47 -5
- package/dist/uni-app-x/component-local-style.d.ts +1 -0
- package/dist/uni-app-x/style-asset/style-value.d.ts +1 -1
- package/dist/{vite-BNlPdsGM.js → vite-DUVjMduj.js} +550 -273
- package/dist/{vite-CBU5NXTX.mjs → vite-nXZEiwG0.mjs} +501 -224
- package/dist/vite.js +1 -1
- package/dist/vite.mjs +1 -1
- package/dist/weapp-tw-css-generation-loader.js +12 -0
- package/dist/weapp-tw-css-import-rewrite-loader-DNk0IxAt.js +10198 -0
- package/dist/weapp-tw-css-import-rewrite-loader.js +6 -10255
- package/dist/{webpack-CZ38fMGC.mjs → webpack-C_UUFRgj.mjs} +223 -57
- package/dist/{webpack-Jpe048pQ.js → webpack-nppysF4B.js} +232 -66
- package/dist/webpack.js +1 -1
- package/dist/webpack.mjs +1 -1
- package/package.json +11 -3
- package/dist/auto-CrJJc5rK.mjs +0 -13
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { hasCssMacroStyleOptions, hasCssMacroTailwindV4CustomVariantConditionalComments, hasCssMacroTailwindV4InternalAtRules, hasCssMacroTailwindV4Source, transformCssMacroCss, transformCssMacroTailwindV4Source, withCssMacroStyleOptions } from "@weapp-tailwindcss/postcss";
|
|
2
|
+
//#region src/css-macro/auto.ts
|
|
3
|
+
const CSS_MACRO_PLUGIN_MARKER = "__weappTailwindcssCssMacro";
|
|
4
|
+
function markCssMacroPlugin(value) {
|
|
5
|
+
Object.defineProperty(value, CSS_MACRO_PLUGIN_MARKER, {
|
|
6
|
+
configurable: false,
|
|
7
|
+
enumerable: false,
|
|
8
|
+
value: true
|
|
9
|
+
});
|
|
10
|
+
return value;
|
|
11
|
+
}
|
|
12
|
+
//#endregion
|
|
13
|
+
export { markCssMacroPlugin as a, withCssMacroStyleOptions as c, hasCssMacroTailwindV4Source as i, hasCssMacroTailwindV4CustomVariantConditionalComments as n, transformCssMacroCss as o, hasCssMacroTailwindV4InternalAtRules as r, transformCssMacroTailwindV4Source as s, hasCssMacroStyleOptions as t };
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import type { UserDefinedOptions } from '../../../../types';
|
|
2
2
|
export declare function createNativeGulpFrameworkPlugins(options?: UserDefinedOptions): {
|
|
3
|
+
adaptWxss: (options?: Partial<import("@weapp-tailwindcss/postcss").IStyleHandlerOptions>) => import("node:stream").Transform;
|
|
4
|
+
generateWxss: (options?: Partial<import("@weapp-tailwindcss/postcss").IStyleHandlerOptions>) => import("node:stream").Transform;
|
|
3
5
|
transformWxss: (options?: Partial<import("@weapp-tailwindcss/postcss").IStyleHandlerOptions>) => import("node:stream").Transform;
|
|
4
6
|
transformWxml: (options?: Partial<import("@/types").ITemplateHandlerOptions>) => import("node:stream").Transform;
|
|
5
7
|
transformJs: (options?: Partial<import("@/types").CreateJsHandlerOptions>) => import("node:stream").Transform;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import type { UserDefinedOptions } from '../../types';
|
|
2
2
|
export declare function createPlugins(options?: UserDefinedOptions): {
|
|
3
|
+
adaptWxss: (options?: Partial<import("@weapp-tailwindcss/postcss").IStyleHandlerOptions>) => import("node:stream").Transform;
|
|
4
|
+
generateWxss: (options?: Partial<import("@weapp-tailwindcss/postcss").IStyleHandlerOptions>) => import("node:stream").Transform;
|
|
3
5
|
transformWxss: (options?: Partial<import("@weapp-tailwindcss/postcss").IStyleHandlerOptions>) => import("node:stream").Transform;
|
|
4
6
|
transformWxml: (options?: Partial<import("@/types").ITemplateHandlerOptions>) => import("node:stream").Transform;
|
|
5
7
|
transformJs: (options?: Partial<import("@/types").CreateJsHandlerOptions>) => import("node:stream").Transform;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import type { CreateJsHandlerOptions, IStyleHandlerOptions, ITemplateHandlerOptions, UserDefinedOptions } from '../../../types';
|
|
2
2
|
export declare function createNativeGulpPlugins(options?: UserDefinedOptions): {
|
|
3
|
+
adaptWxss: (options?: Partial<IStyleHandlerOptions>) => import("node:stream").Transform;
|
|
4
|
+
generateWxss: (options?: Partial<IStyleHandlerOptions>) => import("node:stream").Transform;
|
|
3
5
|
transformWxss: (options?: Partial<IStyleHandlerOptions>) => import("node:stream").Transform;
|
|
4
6
|
transformWxml: (options?: Partial<ITemplateHandlerOptions>) => import("node:stream").Transform;
|
|
5
7
|
transformJs: (options?: Partial<CreateJsHandlerOptions>) => import("node:stream").Transform;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
export interface BundlerGeneratedCssMarkerBlock {
|
|
2
|
-
bundler: 'vite' | 'webpack';
|
|
2
|
+
bundler: 'gulp' | 'vite' | 'webpack';
|
|
3
3
|
file?: string | undefined;
|
|
4
4
|
css: string;
|
|
5
5
|
}
|
|
6
|
-
export declare function createBundlerGeneratedCssMarker(bundler: 'vite' | 'webpack', file: string): string;
|
|
6
|
+
export declare function createBundlerGeneratedCssMarker(bundler: 'gulp' | 'vite' | 'webpack', file: string): string;
|
|
7
7
|
export declare function hasBundlerGeneratedCssMarker(source: unknown): boolean;
|
|
8
8
|
export declare function stripBundlerGeneratedCssMarkers(source: string): string;
|
|
9
9
|
export declare function parseBundlerGeneratedCssMarkerBlocks(source: string): BundlerGeneratedCssMarkerBlock[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { cleanLocalCssImportWrapperTailwindDirectives, cleanLocalCssImportWrapperTailwindDirectivesRoot, createCssSourceOrderAppend, isLocalCssImportRequest, isPureLocalCssImportWrapper, isPureLocalCssImportWrapperRoot, normalizeOutputImportRequest, restoreLocalCssImports, rewriteLocalCssImportRequestsForOutput, rewriteLocalCssImportRequestsForOutputRoot, splitLocalCssImports, splitLocalCssImportsRoot, } from '@weapp-tailwindcss/postcss';
|
|
1
|
+
export { cleanLocalCssImportWrapperTailwindDirectives, cleanLocalCssImportWrapperTailwindDirectivesRoot, createCssSourceOrderAppend, isLocalCssImportRequest, isPureLocalCssImportWrapper, isPureLocalCssImportWrapperRoot, normalizeOutputImportRequest, removeMatchingLocalCssImports, removeMatchingLocalCssImportsRoot, restoreLocalCssImports, rewriteLocalCssImportRequestsForOutput, rewriteLocalCssImportRequestsForOutputRoot, splitLocalCssImports, splitLocalCssImportsRoot, } from '@weapp-tailwindcss/postcss';
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import type { IStyleHandlerOptions } from '@weapp-tailwindcss/postcss/types';
|
|
2
2
|
import type { TailwindV4CssSource } from './types';
|
|
3
3
|
export declare function resolvePostcssFromOption(cssHandlerOptions: IStyleHandlerOptions): string | undefined;
|
|
4
|
+
export declare function resolvePostcssRequestOption(cssHandlerOptions: IStyleHandlerOptions): string | undefined;
|
|
4
5
|
export declare function resolvePostcssSourceFile(cssHandlerOptions: IStyleHandlerOptions): string | undefined;
|
|
5
6
|
export declare function resolveCssHandlerSourceOptions(cssHandlerOptions: IStyleHandlerOptions): {
|
|
6
7
|
outputRoot?: string | undefined;
|
|
8
|
+
requestFile?: string | undefined;
|
|
7
9
|
sourceFile?: string | undefined;
|
|
8
10
|
sourceCss?: string | undefined;
|
|
9
11
|
cssSources?: TailwindV4CssSource[] | undefined;
|
|
@@ -25,6 +25,7 @@ export interface GenerateCssByGeneratorOptions {
|
|
|
25
25
|
previousCss?: string | undefined;
|
|
26
26
|
previousClassSet?: Set<string> | undefined;
|
|
27
27
|
deferEmptyScopedCssSource?: boolean | undefined;
|
|
28
|
+
deferCssAdaptation?: boolean | undefined;
|
|
28
29
|
disableSourceScan?: boolean | undefined;
|
|
29
30
|
restoreLocalCssImports?: boolean | undefined;
|
|
30
31
|
}
|
|
@@ -39,6 +40,10 @@ export interface GenerateCssByGeneratorResult {
|
|
|
39
40
|
file: string;
|
|
40
41
|
majorVersion?: number | undefined;
|
|
41
42
|
outputFile?: string | undefined;
|
|
43
|
+
preflightMode?: {
|
|
44
|
+
inject: boolean;
|
|
45
|
+
preserve: boolean;
|
|
46
|
+
} | undefined;
|
|
42
47
|
rawCss?: string | undefined;
|
|
43
48
|
} | undefined;
|
|
44
49
|
}
|
|
@@ -32,6 +32,7 @@ export interface BundleBuildState {
|
|
|
32
32
|
runtimeAffectingHashByFile: Map<string, string>;
|
|
33
33
|
linkedByEntry: Map<string, Set<string>>;
|
|
34
34
|
dependentsByLinkedFile: Map<string, Set<string>>;
|
|
35
|
+
bundleMarkupCandidatesByFile: Map<string, Set<string>>;
|
|
35
36
|
generatorCandidateSignature?: string | undefined;
|
|
36
37
|
}
|
|
37
38
|
interface UpdateBundleBuildStateOptions {
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { BundleSnapshot } from '../bundle-state';
|
|
2
|
+
import type { SourceCandidateFilterOptions } from '../source-candidates';
|
|
3
|
+
import type { createTransformFilter } from './transform-filter';
|
|
4
|
+
import type { TailwindSourceEntry } from '../../../tailwindcss/source-scan';
|
|
5
|
+
interface CollectBundleMarkupCandidatesOptions {
|
|
6
|
+
extractSourceCandidates?: ((file: string, source: string) => Promise<Set<string>>) | undefined;
|
|
7
|
+
previousCandidatesByFile?: ReadonlyMap<string, Set<string>> | undefined;
|
|
8
|
+
preserveMissingFiles?: boolean | undefined;
|
|
9
|
+
resolveSourceCandidateFile: (file: string) => string | undefined;
|
|
10
|
+
rootDir: string;
|
|
11
|
+
snapshot: BundleSnapshot;
|
|
12
|
+
transformFilter: ReturnType<typeof createTransformFilter>;
|
|
13
|
+
}
|
|
14
|
+
export interface BundleMarkupCandidateCollection {
|
|
15
|
+
candidatesByFile: Map<string, Set<string>>;
|
|
16
|
+
values: Set<string>;
|
|
17
|
+
valuesForEntries: (entries: TailwindSourceEntry[] | undefined, options?: SourceCandidateFilterOptions) => Set<string>;
|
|
18
|
+
}
|
|
19
|
+
export declare function collectBundleMarkupCandidates(options: CollectBundleMarkupCandidatesOptions): Promise<BundleMarkupCandidateCollection>;
|
|
20
|
+
export {};
|
|
@@ -55,5 +55,6 @@ interface ProcessRememberedCssReplayOptions {
|
|
|
55
55
|
useIncrementalMode: boolean;
|
|
56
56
|
activeViteCssCacheFiles: Set<string>;
|
|
57
57
|
}
|
|
58
|
+
export declare function shouldSkipRawRememberedCssSource(rawSource: string, sourceFile: string): boolean;
|
|
58
59
|
export declare function processRememberedCssReplay(options: ProcessRememberedCssReplayOptions): Promise<void>;
|
|
59
60
|
export {};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { OutputChunk } from 'rollup';
|
|
2
2
|
import type { BundleSnapshot } from '../bundle-state';
|
|
3
3
|
import type { RememberedCssSource } from './types';
|
|
4
|
+
export declare function isSfcStyleSourceFile(file: string): boolean;
|
|
4
5
|
export interface SfcStyleBlock {
|
|
5
6
|
attrs: string;
|
|
6
7
|
index: number;
|
|
@@ -10,7 +11,7 @@ export interface SfcStyleBlock {
|
|
|
10
11
|
export declare function extractSfcStyleBlocks(source: string): SfcStyleBlock[];
|
|
11
12
|
export declare function extractSfcStyleSources(source: string): string[];
|
|
12
13
|
export declare function hasSfcStyleSources(source: string): boolean;
|
|
13
|
-
export declare function resolveSfcStyleRequestFromKnownSource(sourceFile: string, sfcSource: string | undefined, styleSource: string): string;
|
|
14
|
+
export declare function resolveSfcStyleRequestFromKnownSource(sourceFile: string, sfcSource: string | undefined, styleSource: string, currentRequest?: string): string;
|
|
14
15
|
export declare function hasTailwindGenerationSource(source: string, options?: {
|
|
15
16
|
allowRootDirectives?: boolean | undefined;
|
|
16
17
|
}): boolean;
|
|
@@ -6,4 +6,5 @@ export interface ResolveCurrentSourceCandidateSourceOptions {
|
|
|
6
6
|
rootDir: string;
|
|
7
7
|
sourceRoot?: string | undefined;
|
|
8
8
|
}
|
|
9
|
+
export declare function resolveCurrentSourceCandidateFile(options: ResolveCurrentSourceCandidateSourceOptions): string | undefined;
|
|
9
10
|
export declare function resolveCurrentSourceCandidateSource(options: ResolveCurrentSourceCandidateSourceOptions): string | undefined;
|
|
@@ -7,6 +7,10 @@ import type { SourceCandidateFilterOptions } from '../source-candidates';
|
|
|
7
7
|
import type { TailwindSourceEntry } from '../../../tailwindcss/source-scan';
|
|
8
8
|
import type { InternalUserDefinedOptions } from '../../../types';
|
|
9
9
|
export interface GenerateBundleContext {
|
|
10
|
+
processMarkupAndScripts?: boolean | undefined;
|
|
11
|
+
processStyles?: boolean | undefined;
|
|
12
|
+
shouldProcessBundle?: (() => boolean) | undefined;
|
|
13
|
+
shouldProcessStyles?: (() => boolean) | undefined;
|
|
10
14
|
opts: InternalUserDefinedOptions;
|
|
11
15
|
runtimeState: {
|
|
12
16
|
tailwindRuntime: InternalUserDefinedOptions['tailwindRuntime'];
|
|
@@ -42,6 +46,7 @@ export interface GenerateBundleContext {
|
|
|
42
46
|
getSourceCandidates?: () => Set<string>;
|
|
43
47
|
getSourceCandidateSource?: (file: string) => string | undefined;
|
|
44
48
|
getSourceCandidateSources?: () => Iterable<[string, string]>;
|
|
49
|
+
extractSourceCandidates?: (file: string, source: string) => Promise<Set<string>>;
|
|
45
50
|
getSourceCandidatesForEntries?: ((entries: TailwindSourceEntry[] | undefined, options?: SourceCandidateFilterOptions) => Set<string>) | undefined;
|
|
46
51
|
getSourceCandidateSourcesForEntries?: ((entries: TailwindSourceEntry[] | undefined, options?: SourceCandidateFilterOptions) => Map<string, Set<string>>) | undefined;
|
|
47
52
|
waitForSourceCandidateSyncs?: () => Promise<void>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Plugin } from 'vite';
|
|
2
|
-
interface
|
|
2
|
+
interface ViteCssGenerationOptions {
|
|
3
3
|
generateCss: (id: string, code: string, hookContext?: {
|
|
4
4
|
addWatchFile?: (id: string) => void;
|
|
5
5
|
emitFile?: (emittedFile: {
|
|
@@ -11,6 +11,7 @@ interface ViteServeCssGenerationOptions {
|
|
|
11
11
|
getCommand: () => string | undefined;
|
|
12
12
|
onTailwindRootCss?: ((id: string, code: string) => Promise<void> | void) | undefined;
|
|
13
13
|
shouldGenerate: () => boolean;
|
|
14
|
+
shouldGenerateBuild?: (() => boolean) | undefined;
|
|
14
15
|
}
|
|
15
|
-
export declare function
|
|
16
|
+
export declare function createViteCssGenerationPlugins(options: ViteCssGenerationOptions): Plugin[];
|
|
16
17
|
export {};
|
|
@@ -12,6 +12,7 @@ export interface WeappTailwindcssVitePlugin {
|
|
|
12
12
|
}
|
|
13
13
|
export interface ViteFrameworkBranchContext {
|
|
14
14
|
frameworkName: ViteFrameworkName;
|
|
15
|
+
adaptWatchCssBeforeFrameworkCache?: boolean;
|
|
15
16
|
createExtraPlugins?: (context: ViteFrameworkExtraPluginContext) => Plugin[];
|
|
16
17
|
cssPipelineStrategy?: ViteFrameworkCssPipelineStrategy | undefined;
|
|
17
18
|
getExtraPluginPlatform?: () => ViteFrameworkExtraPluginPlatform;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ResolvedConfig } from 'vite';
|
|
2
|
+
export interface FrameworkWatchCssAdaptationOptions {
|
|
3
|
+
enabled: boolean;
|
|
4
|
+
isWatchBuild: boolean;
|
|
5
|
+
isWebGeneratorBranch: boolean;
|
|
6
|
+
ownsTailwindGeneration: boolean;
|
|
7
|
+
platform?: string | undefined;
|
|
8
|
+
}
|
|
9
|
+
export declare function shouldAdaptFrameworkWatchCssBeforeCache(options: FrameworkWatchCssAdaptationOptions): boolean;
|
|
10
|
+
export declare function wrapViteCssPostTransform(config: ResolvedConfig, transformCss: (css: string, id: string) => Promise<string>): boolean;
|
|
@@ -14,11 +14,13 @@ interface ChunkLike {
|
|
|
14
14
|
interface ModuleLike {
|
|
15
15
|
context?: string;
|
|
16
16
|
dependencies?: Array<unknown> | Iterable<unknown>;
|
|
17
|
+
identifier?: () => string;
|
|
17
18
|
modules?: ModuleLike[] | Iterable<ModuleLike>;
|
|
18
19
|
request?: string;
|
|
19
20
|
resource?: string;
|
|
20
21
|
rootModule?: ModuleLike;
|
|
21
22
|
userRequest?: string;
|
|
23
|
+
type?: string;
|
|
22
24
|
}
|
|
23
25
|
interface ChunkGraphLike {
|
|
24
26
|
getChunkModulesIterable?: (chunk: ChunkLike) => Iterable<ModuleLike> | undefined;
|
|
@@ -42,6 +44,10 @@ export declare function createWebpackCssAssetResourceMap(chunks: Iterable<ChunkL
|
|
|
42
44
|
context?: string;
|
|
43
45
|
resource?: string;
|
|
44
46
|
}) => string | undefined): Map<string, Set<string>>;
|
|
47
|
+
export declare function createWebpackDirectCssAssetResourceMap(chunks: Iterable<ChunkLike>, chunkGraph: ChunkGraphLike | undefined, cssMatcher: (file: string) => boolean, normalizeResource: (resource: string, issuer?: {
|
|
48
|
+
context?: string;
|
|
49
|
+
resource?: string;
|
|
50
|
+
}) => string | undefined): Map<string, Set<string>>;
|
|
45
51
|
export declare function createAssetHashByChunkMap(chunks: Iterable<ChunkLike>): Map<string, string>;
|
|
46
52
|
export declare function createRuntimeAwareCssHash(assetHash: string | undefined, sourceHash: string, runtimeSetHash: string): string;
|
|
47
53
|
export declare function hasWatchChanges(compiler: WebpackWatchChangeLike): boolean;
|
|
@@ -20,6 +20,7 @@ export declare function createWebpackCssSourceResolvers(options: {
|
|
|
20
20
|
};
|
|
21
21
|
cssAssetFiles: Iterable<string>;
|
|
22
22
|
cssAssetResources: ReadonlyMap<string, ReadonlySet<string>>;
|
|
23
|
+
directCssAssetResources: ReadonlyMap<string, ReadonlySet<string>>;
|
|
23
24
|
cssHandlerOptionsCache: Map<string, WebpackCssHandlerOptions>;
|
|
24
25
|
cssSources: Map<string, {
|
|
25
26
|
css: string | undefined;
|
|
@@ -37,12 +37,14 @@ export declare function stripTrailingLineWhitespace(source: string): string;
|
|
|
37
37
|
export declare function pruneWebpackCssHandlerOptionCaches(cssHandlerOptionsCache: Map<string, WebpackCssHandlerOptions>, cssUserHandlerOptionsCache: Map<string, WebpackCssHandlerOptions>, activeCssFiles: Set<string>): void;
|
|
38
38
|
export declare function resolveWebpackGeneratorRawSource(rawSource: string, cssHandlerOptions: WebpackCssHandlerOptions): string;
|
|
39
39
|
export declare function shouldConsumeWebpackLoaderGeneratedCss(options: {
|
|
40
|
+
allowMarkerlessRegistryMatch?: boolean | undefined;
|
|
40
41
|
hasBundlerGeneratedCssMarker: boolean;
|
|
41
42
|
loaderGeneratedClassSet?: Set<string> | undefined;
|
|
42
43
|
sourceCandidates?: Set<string> | undefined;
|
|
43
44
|
shouldRegenerateExplicitTailwindV4CssSource: boolean;
|
|
44
45
|
watchMode?: boolean | undefined;
|
|
45
46
|
}): boolean;
|
|
47
|
+
export declare function hasDeferredWebpackGeneratedCss(source: string, generatedClassSets: Iterable<ReadonlySet<string>>): boolean;
|
|
46
48
|
export interface WebpackGeneratorUserCssSource {
|
|
47
49
|
css: string;
|
|
48
50
|
processed: boolean;
|
|
@@ -33,6 +33,7 @@ export interface WebpackCssImportRewriteRuntimeOptions {
|
|
|
33
33
|
registerCssSourceFile?: (source: WebpackCssSourceRegistration) => void;
|
|
34
34
|
}
|
|
35
35
|
export interface WebpackCssImportRewriteLoaderOptions {
|
|
36
|
+
generateCss?: boolean | undefined;
|
|
36
37
|
tailwindcssImportRewrite?: WebpackCssImportRewriteRuntimeOptions;
|
|
37
38
|
tailwindcssImportRewriteRuntimeKey?: string;
|
|
38
39
|
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type webpack from 'webpack';
|
|
2
|
+
import type { WebpackCssImportRewriteLoaderOptions } from './runtime-registry';
|
|
3
|
+
declare const WeappTwCssGenerationLoader: webpack.LoaderDefinitionFunction<WebpackCssImportRewriteLoaderOptions>;
|
|
4
|
+
export default WeappTwCssGenerationLoader;
|
|
@@ -3,6 +3,9 @@ import type { WebpackCssImportRewriteLoaderOptions } from './runtime-registry';
|
|
|
3
3
|
import { Buffer } from 'node:buffer';
|
|
4
4
|
interface CssImportRewriteLoaderOptions extends WebpackCssImportRewriteLoaderOptions {
|
|
5
5
|
}
|
|
6
|
+
export declare function resolveWebpackCssPipelineLoaderOptions(options: CssImportRewriteLoaderOptions | undefined): CssImportRewriteLoaderOptions | undefined;
|
|
7
|
+
export declare function generateCssForWebpackPipeline(source: string, loaderContext: webpack.LoaderContext<CssImportRewriteLoaderOptions>, options: CssImportRewriteLoaderOptions | undefined): Promise<string | undefined>;
|
|
8
|
+
export declare function registerWebpackCssGeneratorSource(source: string, resourcePath: string, options: CssImportRewriteLoaderOptions | undefined): void | Promise<void> | undefined;
|
|
6
9
|
export declare function transformCssImportRewriteSource(source: string | Buffer, options: CssImportRewriteLoaderOptions | undefined): string | Buffer<ArrayBufferLike>;
|
|
7
10
|
declare const WeappTwCssImportRewriteLoader: webpack.LoaderDefinitionFunction<CssImportRewriteLoaderOptions>;
|
|
8
11
|
export default WeappTwCssImportRewriteLoader;
|
|
@@ -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-CEo920So.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-xs704TRw.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";
|
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-BgGWVAmN.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 });
|
package/dist/css-macro.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { resolveUniUtsPlatform as resolveUniUtsPlatform$1 } from "./framework.mjs";
|
|
2
|
-
import {
|
|
2
|
+
import { c as withCssMacroStyleOptions, i as hasCssMacroTailwindV4Source, o as transformCssMacroCss, s as transformCssMacroTailwindV4Source, t as hasCssMacroStyleOptions } from "./auto-2dg_uhEJ.mjs";
|
|
3
3
|
import { t as omitUndefined } from "./object-BJSWl-E5.mjs";
|
|
4
4
|
import "./utils-MVwpU07P.mjs";
|
|
5
5
|
import { createRequire } from "node:module";
|
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-CEo920So.mjs";
|
|
2
2
|
export { createWeappTailwindcssGenerator, createWeappTailwindcssGeneratorFromRuntime, normalizeWeappTailwindcssGeneratorOptions, resolveTailwindSourceFromRuntime, resolveTailwindV4Source, resolveTailwindV4SourceFromRuntime, resolveTailwindV4SourceFromRuntimeOptions, resolveTailwindV4SourceOptionsFromRuntime, transformTailwindV4CssByTarget, transformTailwindV4CssToWeapp };
|
|
@@ -3,7 +3,7 @@ const require_generator = require("./generator-CEnUsjed.js");
|
|
|
3
3
|
const require_tailwindcss = require("./tailwindcss-KBYPJ2DW.js");
|
|
4
4
|
const require_wxml = require("./wxml-Ce10eREX.js");
|
|
5
5
|
const require_context = require("./context-VeFq_8vW.js");
|
|
6
|
-
const require_hmr_timing = require("./hmr-timing-
|
|
6
|
+
const require_hmr_timing = require("./hmr-timing-B8p4f0ca.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");
|
|
@@ -223,6 +223,7 @@ function createNativeGulpPlugins(options = {}) {
|
|
|
223
223
|
let runtimeSetDirty = false;
|
|
224
224
|
const runtimeSourceHashByFile = /* @__PURE__ */ new Map();
|
|
225
225
|
const runtimeSourcesByFile = /* @__PURE__ */ new Map();
|
|
226
|
+
const generatedCssPreflightModeByFile = /* @__PURE__ */ new Map();
|
|
226
227
|
let cachedGulpSourceCandidateSignature;
|
|
227
228
|
const gulpProcessCacheKeys = /* @__PURE__ */ new Set();
|
|
228
229
|
const bundleRuntimeClassSetManager = options.__internalGulpRuntimeClassSetManager ?? require_hmr_timing.createBundleRuntimeClassSetManager();
|
|
@@ -420,58 +421,89 @@ function createNativeGulpPlugins(options = {}) {
|
|
|
420
421
|
runtimeSourcesByFile
|
|
421
422
|
}) };
|
|
422
423
|
}
|
|
423
|
-
|
|
424
|
+
function createWxssTransform(options, stage) {
|
|
425
|
+
return createVinylTransform(`css:${stage}`, async (file) => {
|
|
426
|
+
if (!file.contents) return;
|
|
427
|
+
const rawSource = file.contents.toString();
|
|
428
|
+
const cssSourceChanged = await registerAutoCssSource(file, rawSource);
|
|
429
|
+
const shouldUseGenerator = runtimeState.tailwindRuntime.majorVersion === 4;
|
|
430
|
+
let gulpSourceCandidateGetter;
|
|
431
|
+
if (shouldUseGenerator) gulpSourceCandidateGetter = await refreshGulpV4SourceCandidates(cssSourceChanged);
|
|
432
|
+
const nextRuntimeSet = await refreshRuntimeSet({
|
|
433
|
+
forceRefresh: cssSourceChanged,
|
|
434
|
+
forceCollect: cssSourceChanged,
|
|
435
|
+
clearCache: cssSourceChanged
|
|
436
|
+
});
|
|
437
|
+
const sourceTraceTokenSources = cachedGulpSourceCandidateSourceGetter ? require_hmr_timing.createCssTokenSourceMap(cachedGulpSourceCandidateSourceGetter(void 0), opts) : void 0;
|
|
438
|
+
const sourceTraceSignature = require_hmr_timing.createCssSourceTraceCacheSignature(sourceTraceTokenSources, opts);
|
|
439
|
+
const sourceCandidateSignature = cachedGulpSourceCandidateGetter ? `gulp-source-candidates:1:${[...cachedGulpSourceCandidateGetter(void 0)].sort().join("\n")}` : void 0;
|
|
440
|
+
const styleOutputExtension = resolveGulpStyleOutputExtension(file);
|
|
441
|
+
const outputSignature = styleOutputExtension ? `gulp-output:1:${stage}:${styleOutputExtension}` : `gulp-output:0:${stage}`;
|
|
442
|
+
await require_hmr_timing.processCachedTask({
|
|
443
|
+
cache,
|
|
444
|
+
cacheKey: file.path,
|
|
445
|
+
hash: createRuntimeSetHash(rawSource, nextRuntimeSet, sourceTraceSignature, sourceCandidateSignature, outputSignature),
|
|
446
|
+
applyResult(source) {
|
|
447
|
+
file.contents = node_buffer.Buffer.from(source);
|
|
448
|
+
},
|
|
449
|
+
onCacheHit() {
|
|
450
|
+
debug("css cache hit: %s", file.path);
|
|
451
|
+
},
|
|
452
|
+
async transform() {
|
|
453
|
+
await runtimeState.readyPromise;
|
|
454
|
+
const cssHandlerOptions = resolveWxssFileHandlerOptions(file, rawSource, options);
|
|
455
|
+
const generated = shouldUseGenerator ? await require_hmr_timing.generateCssByGenerator({
|
|
456
|
+
opts,
|
|
457
|
+
runtimeState,
|
|
458
|
+
runtime: nextRuntimeSet,
|
|
459
|
+
rawSource,
|
|
460
|
+
file: file.path,
|
|
461
|
+
cssHandlerOptions,
|
|
462
|
+
cssUserHandlerOptions: resolveWxssUserHandlerOptions(options),
|
|
463
|
+
getSourceCandidatesForEntries: gulpSourceCandidateGetter,
|
|
464
|
+
styleHandler,
|
|
465
|
+
debug,
|
|
466
|
+
deferCssAdaptation: stage === "generate"
|
|
467
|
+
}) : void 0;
|
|
468
|
+
const transformedCss = generated?.css ?? (stage === "generate" ? rawSource : (await styleHandler(rawSource, cssHandlerOptions)).css);
|
|
469
|
+
if (stage === "generate") {
|
|
470
|
+
const preflightMode = generated?.metadata?.preflightMode;
|
|
471
|
+
if (preflightMode) generatedCssPreflightModeByFile.set(file.path, preflightMode);
|
|
472
|
+
else generatedCssPreflightModeByFile.delete(file.path);
|
|
473
|
+
}
|
|
474
|
+
const css = require_hmr_timing.annotateCssSourceTrace(transformedCss, {
|
|
475
|
+
opts,
|
|
476
|
+
tokenSources: sourceTraceTokenSources
|
|
477
|
+
});
|
|
478
|
+
const generatedCss = stage === "generate" && generated ? `${require_hmr_timing.createBundlerGeneratedCssMarker("gulp", file.path)}\n${css}` : css;
|
|
479
|
+
const outputCss = stage === "generate" ? generatedCss : (0, _weapp_tailwindcss_postcss.rewriteLocalCssImportRequestsForOutput)(generatedCss, { styleOutputExtension });
|
|
480
|
+
debug("css handle: %s", file.path);
|
|
481
|
+
return { result: outputCss };
|
|
482
|
+
}
|
|
483
|
+
});
|
|
484
|
+
rememberGulpProcessCacheKey(gulpProcessCacheKeys, file.path);
|
|
485
|
+
pruneGulpProcessCache(cache, gulpProcessCacheKeys);
|
|
486
|
+
}, () => resolveGulpTransformTimingDetails(`css:${stage}`));
|
|
487
|
+
}
|
|
488
|
+
const generateWxss = (options = {}) => createWxssTransform(options, "generate");
|
|
489
|
+
const transformWxss = (options = {}) => createWxssTransform(options, "transform");
|
|
490
|
+
const adaptWxss = (options = {}) => createVinylTransform("css:adapt", async (file) => {
|
|
424
491
|
if (!file.contents) return;
|
|
425
492
|
const rawSource = file.contents.toString();
|
|
426
|
-
const
|
|
427
|
-
const
|
|
428
|
-
let gulpSourceCandidateGetter;
|
|
429
|
-
if (shouldUseGenerator) gulpSourceCandidateGetter = await refreshGulpV4SourceCandidates(cssSourceChanged);
|
|
430
|
-
const nextRuntimeSet = await refreshRuntimeSet({
|
|
431
|
-
forceRefresh: cssSourceChanged,
|
|
432
|
-
forceCollect: cssSourceChanged,
|
|
433
|
-
clearCache: cssSourceChanged
|
|
434
|
-
});
|
|
435
|
-
const sourceTraceTokenSources = cachedGulpSourceCandidateSourceGetter ? require_hmr_timing.createCssTokenSourceMap(cachedGulpSourceCandidateSourceGetter(void 0), opts) : void 0;
|
|
436
|
-
const sourceTraceSignature = require_hmr_timing.createCssSourceTraceCacheSignature(sourceTraceTokenSources, opts);
|
|
437
|
-
const sourceCandidateSignature = cachedGulpSourceCandidateGetter ? `gulp-source-candidates:1:${[...cachedGulpSourceCandidateGetter(void 0)].sort().join("\n")}` : void 0;
|
|
493
|
+
const generatedCss = require_hmr_timing.hasBundlerGeneratedCssMarker(rawSource);
|
|
494
|
+
const source = generatedCss ? require_hmr_timing.stripBundlerGeneratedCssMarkers(rawSource) : rawSource;
|
|
438
495
|
const styleOutputExtension = resolveGulpStyleOutputExtension(file);
|
|
439
|
-
const
|
|
440
|
-
await
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
async transform() {
|
|
451
|
-
await runtimeState.readyPromise;
|
|
452
|
-
const cssHandlerOptions = resolveWxssFileHandlerOptions(file, rawSource, options);
|
|
453
|
-
const outputCss = (0, _weapp_tailwindcss_postcss.rewriteLocalCssImportRequestsForOutput)(require_hmr_timing.annotateCssSourceTrace((shouldUseGenerator ? await require_hmr_timing.generateCssByGenerator({
|
|
454
|
-
opts,
|
|
455
|
-
runtimeState,
|
|
456
|
-
runtime: nextRuntimeSet,
|
|
457
|
-
rawSource,
|
|
458
|
-
file: file.path,
|
|
459
|
-
cssHandlerOptions,
|
|
460
|
-
cssUserHandlerOptions: resolveWxssUserHandlerOptions(options),
|
|
461
|
-
getSourceCandidatesForEntries: gulpSourceCandidateGetter,
|
|
462
|
-
styleHandler,
|
|
463
|
-
debug
|
|
464
|
-
}) : void 0)?.css ?? (await styleHandler(rawSource, cssHandlerOptions)).css, {
|
|
465
|
-
opts,
|
|
466
|
-
tokenSources: sourceTraceTokenSources
|
|
467
|
-
}), { styleOutputExtension });
|
|
468
|
-
debug("css handle: %s", file.path);
|
|
469
|
-
return { result: outputCss };
|
|
470
|
-
}
|
|
471
|
-
});
|
|
472
|
-
rememberGulpProcessCacheKey(gulpProcessCacheKeys, file.path);
|
|
473
|
-
pruneGulpProcessCache(cache, gulpProcessCacheKeys);
|
|
474
|
-
}, () => resolveGulpTransformTimingDetails("css"));
|
|
496
|
+
const cssHandlerOptions = resolveWxssFileHandlerOptions(file, source, options);
|
|
497
|
+
const handled = await styleHandler(source, cssHandlerOptions);
|
|
498
|
+
const preflightMode = generatedCssPreflightModeByFile.get(file.path);
|
|
499
|
+
const finalized = generatedCss ? require_hmr_timing.finalizeMiniProgramGeneratorCss(handled.css, "weapp", runtimeState.tailwindRuntime.majorVersion, opts.cssPreflight, {
|
|
500
|
+
injectPreflight: preflightMode?.inject ?? cssHandlerOptions.isMainChunk,
|
|
501
|
+
preservePreflight: preflightMode?.preserve ?? cssHandlerOptions.isMainChunk,
|
|
502
|
+
styleOptions: cssHandlerOptions
|
|
503
|
+
}) : handled.css;
|
|
504
|
+
file.contents = node_buffer.Buffer.from((0, _weapp_tailwindcss_postcss.rewriteLocalCssImportRequestsForOutput)(finalized, { styleOutputExtension }));
|
|
505
|
+
debug("css adapt: %s", file.path);
|
|
506
|
+
}, () => resolveGulpTransformTimingDetails("css:adapt"));
|
|
475
507
|
const transformJs = (options = {}) => createVinylTransform("js", async (file) => {
|
|
476
508
|
if (!file.contents) return;
|
|
477
509
|
const filename = node_path.default.resolve(file.path);
|
|
@@ -541,6 +573,8 @@ function createNativeGulpPlugins(options = {}) {
|
|
|
541
573
|
pruneGulpProcessCache(cache, gulpProcessCacheKeys);
|
|
542
574
|
}, () => resolveGulpTransformTimingDetails("html"));
|
|
543
575
|
return {
|
|
576
|
+
adaptWxss,
|
|
577
|
+
generateWxss,
|
|
544
578
|
transformWxss,
|
|
545
579
|
transformWxml,
|
|
546
580
|
transformJs
|