weapp-tailwindcss 5.1.0 → 5.1.1

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.
Files changed (83) hide show
  1. package/dist/bundlers/shared/generator-css/class-selectors.d.ts +2 -0
  2. package/dist/bundlers/shared/generator-css/generation-helpers.d.ts +6 -14
  3. package/dist/bundlers/shared/generator-css/source-resolver/metadata.d.ts +1 -1
  4. package/dist/bundlers/shared/generator-css/source-resolver.d.ts +2 -2
  5. package/dist/bundlers/shared/generator-css/validate.d.ts +1 -0
  6. package/dist/bundlers/vite/css-memory.d.ts +6 -0
  7. package/dist/bundlers/vite/generate-bundle/css-assets.d.ts +1 -1
  8. package/dist/bundlers/vite/generate-bundle/css-handler-options.d.ts +1 -1
  9. package/dist/bundlers/vite/generate-bundle/css-output-helpers.d.ts +39 -0
  10. package/dist/bundlers/vite/generate-bundle/env-flags.d.ts +1 -0
  11. package/dist/bundlers/vite/generate-bundle/final-css-assets.d.ts +2 -1
  12. package/dist/bundlers/vite/generate-bundle/finalize.d.ts +2 -0
  13. package/dist/bundlers/vite/generate-bundle/html-processing.d.ts +26 -0
  14. package/dist/bundlers/vite/generate-bundle/js-processing.d.ts +4 -0
  15. package/dist/bundlers/vite/generate-bundle/remembered-css-replay.d.ts +1 -1
  16. package/dist/bundlers/vite/generate-bundle/remembered-css.d.ts +1 -1
  17. package/dist/bundlers/vite/generate-bundle/root-style-output.d.ts +6 -0
  18. package/dist/bundlers/vite/generate-bundle/runtime-linked-source-memory.d.ts +25 -0
  19. package/dist/bundlers/vite/generate-bundle/source-candidate-source.d.ts +9 -0
  20. package/dist/bundlers/vite/generate-bundle/tailwind-v4-css-source.d.ts +9 -0
  21. package/dist/bundlers/vite/generate-bundle/transform-filter.d.ts +15 -0
  22. package/dist/bundlers/vite/generate-bundle/types.d.ts +1 -0
  23. package/dist/bundlers/vite/generate-bundle.d.ts +1 -2
  24. package/dist/bundlers/vite/plugin-cache.d.ts +15 -0
  25. package/dist/bundlers/vite/runtime-class-set.d.ts +2 -1
  26. package/dist/bundlers/webpack/BaseUnifiedPlugin/shared.d.ts +3 -3
  27. package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets/css-source-resolvers.d.ts +34 -0
  28. package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets/js-module-graph.d.ts +37 -0
  29. package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets/pipeline-helpers.d.ts +199 -0
  30. package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets/source-candidate-refresh.d.ts +11 -0
  31. package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets.d.ts +1 -0
  32. package/dist/cli.js +15 -8
  33. package/dist/cli.mjs +15 -8
  34. package/dist/context/style-options.d.ts +1 -0
  35. package/dist/{context-BHxLe743.js → context-B6hVF7dr.js} +20 -9
  36. package/dist/{context-Mbzkek1q.mjs → context-DlpKD7aN.mjs} +15 -10
  37. package/dist/core.js +1 -1
  38. package/dist/core.mjs +1 -1
  39. package/dist/css-macro/index.d.ts +3 -7
  40. package/dist/{defaults-ZElj1zKc.mjs → defaults-BhE26nSw.mjs} +7 -3
  41. package/dist/{defaults-CVcKbXBG.js → defaults-CmFBmxsr.js} +7 -3
  42. package/dist/defaults.d.ts +1 -1
  43. package/dist/defaults.js +1 -1
  44. package/dist/defaults.mjs +1 -1
  45. package/dist/generator/types.d.ts +1 -1
  46. package/dist/{generator-9rUz4Hcb.js → generator-6oMJtTDO.js} +1 -1
  47. package/dist/{generator-Dc4qaPmT.mjs → generator-CjzBK7h-.mjs} +1 -1
  48. package/dist/generator.js +2 -2
  49. package/dist/generator.mjs +2 -2
  50. package/dist/{gulp-B_sdP6dx.js → gulp-BtGq6LP9.js} +11 -9
  51. package/dist/{gulp-uM36oIJs.mjs → gulp-DNU10Vtc.mjs} +11 -9
  52. package/dist/gulp.js +1 -1
  53. package/dist/gulp.mjs +1 -1
  54. package/dist/{hmr-timing-BXMLsF4b.mjs → hmr-timing-B0KuWDjV.mjs} +121 -85
  55. package/dist/{hmr-timing-CogqkFaF.js → hmr-timing-CegXR9O4.js} +132 -84
  56. package/dist/index.js +4 -4
  57. package/dist/index.mjs +4 -4
  58. package/dist/postcss.js +2 -2
  59. package/dist/postcss.mjs +2 -2
  60. package/dist/presets.js +2 -2
  61. package/dist/presets.mjs +2 -2
  62. package/dist/{source-candidate-scan-signature-Cvb5z1ha.mjs → source-candidate-scan-signature-B5af2Ahe.mjs} +3 -3
  63. package/dist/{source-candidate-scan-signature-2ybpptAK.js → source-candidate-scan-signature-BKYb9jxa.js} +3 -3
  64. package/dist/tailwindcss/runtime-types.d.ts +1 -0
  65. package/dist/tailwindcss/v4-engine/source.d.ts +5 -14
  66. package/dist/tailwindcss/v4-engine/types.d.ts +10 -2
  67. package/dist/{tailwindcss-wyUHrfil.mjs → tailwindcss-B5mRo0-M.mjs} +12 -7
  68. package/dist/{tailwindcss-DHIYcqXT.js → tailwindcss-dbrbY4cd.js} +11 -6
  69. package/dist/{transform-tExdt40m.mjs → transform-fRBeuuK-.mjs} +1 -1
  70. package/dist/{transform-CQVOgmzM.js → transform-vLwZpiTE.js} +1 -1
  71. package/dist/types/user-defined-options/matcher.d.ts +7 -0
  72. package/dist/{v4-engine-CF9zt4Cw.mjs → v4-engine-C3qSwQ-e.mjs} +7 -27
  73. package/dist/{v4-engine-D4ubP7N5.js → v4-engine-ON_oSLfO.js} +5 -31
  74. package/dist/{vite-CPO83EhA.mjs → vite-CWRooooa.mjs} +730 -393
  75. package/dist/{vite-CP0ylSxZ.js → vite-w-RkgaTY.js} +730 -392
  76. package/dist/vite.js +1 -1
  77. package/dist/vite.mjs +1 -1
  78. package/dist/weapp-tw-css-import-rewrite-loader.js +122 -85
  79. package/dist/{webpack-BzqhJ8yK.mjs → webpack-8PaV1gG3.mjs} +923 -671
  80. package/dist/{webpack-Bsek8VhR.js → webpack-CGgBOx9l.js} +923 -671
  81. package/dist/webpack.js +1 -1
  82. package/dist/webpack.mjs +1 -1
  83. package/package.json +5 -5
@@ -0,0 +1,2 @@
1
+ export declare function collectRawSourceClassSelectors(rawSource: string): Set<string>;
2
+ export declare function collectGeneratedRawSourceCandidates(candidates: Iterable<string>, rawSource: string, escapeMap: Record<string, string> | undefined): Set<string>;
@@ -51,23 +51,15 @@ export declare function shouldUseGeneratorForCurrentCss(_majorVersion: number |
51
51
  hasGeneratedMarkers: boolean;
52
52
  hasSourceDirectives: boolean;
53
53
  rawSource: string;
54
- }): boolean;
54
+ runtimeCandidateCount?: number | undefined;
55
+ target?: string | undefined;
56
+ configuredCssSourceCount?: number | undefined;
57
+ }): boolean | undefined;
55
58
  export declare function hasGeneratorSourceDirectives(source: string, importFallback: boolean): boolean;
56
59
  export declare function createRuntimeWithCurrentCssCandidates(runtime: Set<string>, currentCssCandidates: string[], isolateCurrentCssCandidates: boolean): Set<string>;
57
60
  export declare function mergeGeneratorResults(generatedResults: GeneratorResult[]): (import("@/generator").TailwindV4GenerateResult & {
58
- target: WeappTailwindcssGeneratorTarget;
59
- rawCss: string;
60
- }) | {
61
- css: string;
61
+ target: import("@/generator").WeappTailwindcssGeneratorTarget;
62
62
  rawCss: string;
63
- incrementalCss: string | undefined;
64
- incrementalRawCss: string | undefined;
65
- classSet: Set<string>;
66
- dependencies: string[];
67
- sources: import("@tailwindcss-mangle/engine").TailwindV4SourcePattern[];
68
- target: any;
69
- root: import("@tailwindcss-mangle/engine").TailwindV4CompiledSourceRoot;
70
- rawCandidates: Set<string>;
71
- } | undefined;
63
+ }) | undefined;
72
64
  type GeneratorResult = Awaited<ReturnType<ReturnType<typeof createWeappTailwindcssGenerator>['generate']>>;
73
65
  export {};
@@ -12,4 +12,4 @@ export type GeneratorResolvedSource = TailwindResolvedSource & {
12
12
  __weappTailwindcssMeta?: GeneratorSourceMetadata | undefined;
13
13
  };
14
14
  export declare function withGeneratorSourceMetadata(source: TailwindResolvedSource, metadata: GeneratorSourceMetadata): GeneratorResolvedSource;
15
- export declare function withMatchedSourceSideMetadata(source: TailwindResolvedSource, resolvedEntrySource: SourceSideCssEntrySource): import("@tailwindcss-mangle/engine").TailwindV4ResolvedSource;
15
+ export declare function withMatchedSourceSideMetadata(source: TailwindResolvedSource, resolvedEntrySource: SourceSideCssEntrySource): import("@/generator").TailwindV4ResolvedSource;
@@ -4,6 +4,6 @@ import type { NormalizedWeappTailwindcssGeneratorOptions, TailwindResolvedSource
4
4
  export type { GeneratorResolvedSource, GeneratorSourceMetadata } from './source-resolver/metadata';
5
5
  export { resolveCssSourceBase } from './source-resolver/postcss-source';
6
6
  export type { GeneratorSourceRuntimeState, GeneratorSourceSelectionOptions } from './source-resolver/types';
7
- export declare function resolveGeneratorSource(_majorVersion: number | undefined, runtimeState: GeneratorSourceRuntimeState, rawSource: string, file: string, cssHandlerOptions: IStyleHandlerOptions, generatorOptions?: NormalizedWeappTailwindcssGeneratorOptions, selectionOptions?: GeneratorSourceSelectionOptions): Promise<import("@tailwindcss-mangle/engine").TailwindV4ResolvedSource | undefined>;
7
+ export declare function resolveGeneratorSource(_majorVersion: number | undefined, runtimeState: GeneratorSourceRuntimeState, rawSource: string, file: string, cssHandlerOptions: IStyleHandlerOptions, generatorOptions?: NormalizedWeappTailwindcssGeneratorOptions, selectionOptions?: GeneratorSourceSelectionOptions): Promise<import("@/generator").TailwindV4ResolvedSource | undefined>;
8
8
  export declare function resolveGeneratorSources(majorVersion: number | undefined, runtimeState: GeneratorSourceRuntimeState, rawSource: string, file: string, cssHandlerOptions: IStyleHandlerOptions, generatorOptions?: NormalizedWeappTailwindcssGeneratorOptions, selectionOptions?: GeneratorSourceSelectionOptions): Promise<TailwindResolvedSource[]>;
9
- export declare function resolveGeneratorSourceEntries(source: TailwindResolvedSource, runtimeState?: GeneratorSourceRuntimeState): Promise<any>;
9
+ export declare function resolveGeneratorSourceEntries(source: TailwindResolvedSource, runtimeState?: GeneratorSourceRuntimeState): Promise<import("@/tailwindcss/source-scan").TailwindSourceEntry[] | undefined>;
@@ -1,6 +1,7 @@
1
1
  import type { GenerateCssByGeneratorOptions } from './types';
2
2
  export interface ValidateCandidatesByGeneratorOptions extends Omit<GenerateCssByGeneratorOptions, 'runtime'> {
3
3
  candidates: Set<string>;
4
+ generatedCssSources?: Iterable<string> | undefined;
4
5
  skipGenerateFallback?: boolean | undefined;
5
6
  }
6
7
  export declare function validateCandidatesByGenerator(options: ValidateCandidatesByGeneratorOptions): Promise<Set<string>>;
@@ -17,6 +17,12 @@ export declare function createViteCssMemory(options: {
17
17
  size: number;
18
18
  };
19
19
  rememberedCssSignatureByFile: number;
20
+ knownCssSources: number;
21
+ knownCssSourcesRaw: {
22
+ bytes: number;
23
+ mb: number;
24
+ size: number;
25
+ };
20
26
  knownSfcSources: number;
21
27
  knownSfcSourcesRaw: {
22
28
  bytes: number;
@@ -1,4 +1,4 @@
1
1
  import type { OutputAsset } from 'rollup';
2
2
  import type { GenerateBundleThis } from './types';
3
- export declare function createCssAssetEmitter(context: Pick<GenerateBundleThis, 'emitFile'>): (fileName: string, source: string) => OutputAsset;
3
+ export declare function createCssAssetEmitter(context: Pick<GenerateBundleThis, 'emitFile'>): (fileName: string, source: string) => OutputAsset | undefined;
4
4
  export declare function resolveAssetSourceFile(asset: OutputAsset, fallbackFile: string): string;
@@ -5,7 +5,7 @@ type CssHandlerOptions = IStyleHandlerOptions & {
5
5
  from: string;
6
6
  };
7
7
  };
8
- majorVersion: number | undefined;
8
+ majorVersion?: 4 | undefined;
9
9
  sourceOptions?: {
10
10
  outputRoot?: string | undefined;
11
11
  } | undefined;
@@ -0,0 +1,39 @@
1
+ import type { OutputAsset, OutputChunk } from 'rollup';
2
+ import type { InternalUserDefinedOptions } from '../../../types';
3
+ export declare function resolveCssBundleOutputFile(options: {
4
+ bundleFiles: string[];
5
+ defaultStyleOutputExtension: string;
6
+ file: string;
7
+ isWebGeneratorTarget: boolean;
8
+ opts: InternalUserDefinedOptions;
9
+ shouldPreserveAppCssExtension: boolean;
10
+ }): string;
11
+ export declare function shouldSkipRawSourceStyleAsset(outputFile: string, file: string, rawSource: string): boolean;
12
+ export declare function resolveOutputFileFromMatchedCssSource(options: {
13
+ bundleFiles: string[];
14
+ defaultStyleOutputExtension: string;
15
+ isWebGeneratorTarget: boolean;
16
+ opts: Pick<InternalUserDefinedOptions, 'cssMatcher' | 'platform'>;
17
+ rootDir: string;
18
+ shouldPreserveAppCssExtension: boolean;
19
+ sourceFile: string | undefined;
20
+ sourceRoot?: string | undefined;
21
+ }): string | undefined;
22
+ export declare function createMatchedCssSourceOutputResolver(options: {
23
+ assetSourceFile: string;
24
+ file: string;
25
+ originalFileNames?: string[] | undefined;
26
+ resolveOutputFileFromMatchedCssSource: (sourceFile: string | undefined) => string | undefined;
27
+ }): (sourceFile: string | undefined) => string | undefined;
28
+ export declare function hasViteProcessedCssResultForSource(sourceFile: string, getViteProcessedCssAssetResults?: (() => Iterable<[string, unknown]> | undefined) | undefined): boolean;
29
+ export declare function applyCssResultToBundle(options: {
30
+ assetSourceFile: string;
31
+ bundle: Record<string, OutputAsset | OutputChunk>;
32
+ emitOrReplayCssAsset: (file: string, source: string) => OutputAsset | undefined;
33
+ file: string;
34
+ originalSource: OutputAsset;
35
+ outputFile: string;
36
+ source: string;
37
+ viteProcessedCssAsset: boolean;
38
+ appType: unknown;
39
+ }): void;
@@ -3,4 +3,5 @@ export declare function resolveGenerateBundleEnvFlags(): {
3
3
  disableDirtyOptimization: boolean;
4
4
  disableJsPrecheck: boolean;
5
5
  debugCssDiff: boolean;
6
+ slowJsAstWarnMs: number;
6
7
  };
@@ -1,8 +1,9 @@
1
1
  import type { OutputAsset, OutputChunk } from 'rollup';
2
2
  import type { GenerateBundleContext } from './types';
3
+ import type { IStyleHandlerOptions } from '../../../types';
3
4
  export declare function finalizeMiniProgramCssAssets(bundle: Record<string, OutputAsset | OutputChunk>, options: {
4
5
  cssMatcher: GenerateBundleContext['opts']['cssMatcher'];
5
- getCssHandlerOptions: GenerateBundleContext['getCssHandlerOptions'];
6
+ getCssHandlerOptions: (file: string) => IStyleHandlerOptions;
6
7
  isWebGeneratorTarget: boolean;
7
8
  lastCssResultByFile?: Map<string, string> | undefined;
8
9
  onUpdate: GenerateBundleContext['opts']['onUpdate'];
@@ -26,6 +26,8 @@ interface FinalizeGenerateBundleOptions {
26
26
  isNativeAppStyleTarget: boolean;
27
27
  isViteProcessedCssAsset: GenerateBundleContext['isViteProcessedCssAsset'];
28
28
  isWebGeneratorTarget: boolean;
29
+ jsAfterCss: boolean;
30
+ jsTaskFactories: Array<() => Promise<void>>;
29
31
  lastCssResultByFile: Map<string, string>;
30
32
  lastCssSourceHashByFile: Map<string, string>;
31
33
  linkedByEntry: Map<string, Set<string>> | undefined;
@@ -0,0 +1,26 @@
1
+ import type { OutputAsset } from 'rollup';
2
+ import type { createEmptyMetrics } from './metrics';
3
+ import { processCachedTask } from '../../shared/cache';
4
+ export interface ProcessHtmlBundleEntryOptions {
5
+ cache: Parameters<typeof processCachedTask<string>>[0]['cache'];
6
+ context: {
7
+ ensureRuntimeClassSet: (force?: boolean) => Promise<Set<string>>;
8
+ };
9
+ debug: (message: string, ...args: unknown[]) => void;
10
+ dynamicRetryCandidates: Set<string>;
11
+ file: string;
12
+ metrics: ReturnType<typeof createEmptyMetrics>;
13
+ onUpdate: (file: string, oldVal: string, newVal: string) => void;
14
+ originalEntrySource: string;
15
+ originalSource: OutputAsset;
16
+ rememberProcessCacheKey: (cacheKey: string, hashKey?: string | number) => void;
17
+ resolveCurrentSourceCandidateSource: (file: string) => string | undefined;
18
+ tasks: Promise<void>[];
19
+ templateHandler: (source: string, options: {
20
+ runtimeSet: Set<string>;
21
+ }) => string | Promise<string>;
22
+ timeTask: (name: string, task: () => Promise<void>) => Promise<void>;
23
+ transformRuntime: Set<string>;
24
+ transformRuntimeSignature: string;
25
+ }
26
+ export declare function processHtmlBundleEntry(options: ProcessHtmlBundleEntryOptions): void;
@@ -22,8 +22,12 @@ interface ProcessJsBundleEntryOptions {
22
22
  rememberProcessCacheKey: (cacheKey: string, hashKey?: string | number) => void;
23
23
  runtimeSignature: string;
24
24
  snapshot: BundleSnapshot;
25
+ shouldSkipAstTransform: ((chunk: OutputChunk) => boolean) | undefined;
26
+ slowJsAstWarnMs: number;
25
27
  timeTask: (name: string, task: () => Promise<void>) => Promise<void>;
26
28
  transformRuntime: Set<string>;
29
+ transformRuntimeSignature: string;
30
+ transformFilterSignature: string;
27
31
  uniAppX: GenerateBundleContext['opts']['uniAppX'];
28
32
  useIncrementalMode: boolean;
29
33
  }
@@ -18,7 +18,7 @@ interface ProcessRememberedCssReplayOptions {
18
18
  cssTaskFactories: Array<() => Promise<void>>;
19
19
  debug: GenerateBundleContext['debug'];
20
20
  defaultStyleOutputExtension: string;
21
- emitOrReplayCssAsset: (fileName: string, source: string) => OutputAsset;
21
+ emitOrReplayCssAsset: (fileName: string, source: string) => OutputAsset | undefined;
22
22
  generatorRuntime: Set<string>;
23
23
  getCssHandlerOptions: (file: string) => ReturnType<ReturnType<typeof import('./css-handler-options').createCssHandlerOptionsCache>['getCssHandlerOptions']>;
24
24
  getCssUserHandlerOptions: (file: string) => ReturnType<ReturnType<typeof import('./css-handler-options').createCssHandlerOptionsCache>['getCssUserHandlerOptions']>;
@@ -5,7 +5,7 @@ export declare function createRememberedCssRuntimeSignature(cssRuntimeSignature:
5
5
  export declare function resolveRememberedCssSourceForTest(sources: Iterable<[string, RememberedCssSource]> | undefined, outputFile: string, file: string, originalSource: OutputAsset, outputRoot: string, sourceRoot: string | undefined): RememberedCssSource | undefined;
6
6
  export declare function findRememberedCssSources(sources: Iterable<[string, RememberedCssSource]> | undefined, outputFile: string, file: string, originalSource: OutputAsset, outputRoot: string, sourceRoot: string | undefined): RememberedCssSource[];
7
7
  export declare function mergeRememberedCssSources(sources: RememberedCssSource[], outputFile: string): RememberedCssSource | undefined;
8
- export declare function collectRememberedCssReplayGroups(sources: Iterable<[string, RememberedCssSource]> | undefined, opts: Pick<InternalUserDefinedOptions, 'cssMatcher'>, rootDir: string, isWebGeneratorTarget: boolean, preserveCssExtension: boolean, sourceRoot?: string | undefined, styleOutputExtension?: string | undefined, styleOutputFiles?: Iterable<string> | undefined): Map<string, {
8
+ export declare function collectRememberedCssReplayGroups(sources: Iterable<[string, RememberedCssSource]> | undefined, opts: Pick<InternalUserDefinedOptions, 'cssMatcher' | 'platform'>, rootDir: string, isWebGeneratorTarget: boolean, preserveCssExtension: boolean, sourceRoot?: string | undefined, styleOutputExtension?: string | undefined, styleOutputFiles?: Iterable<string> | undefined): Map<string, {
9
9
  key: string;
10
10
  remembered: RememberedCssSource;
11
11
  }[]>;
@@ -0,0 +1,6 @@
1
+ export declare function isRootMiniProgramStyleOutputFile(file: string): boolean;
2
+ export declare function createRelativeCssImportRequest(targetFile: string, importedFile: string): string;
3
+ export declare function createCssImportShell(targetFile: string, importedFile: string): string;
4
+ export declare function createRootMiniProgramOriginStyleOutputFile(file: string): string;
5
+ export declare function shouldKeepRootMiniProgramStyleAsImportShell(appType: unknown): appType is "uni-app-x" | "taro" | "uni-app-vite";
6
+ export declare function shouldMoveRootMiniProgramStyleToImportShellOrigin(appType: unknown): appType is "taro";
@@ -0,0 +1,25 @@
1
+ import type { BundleSnapshot } from '../bundle-state';
2
+ import type { RememberedCssSource } from './types';
3
+ import type { InternalUserDefinedOptions } from '../../../types';
4
+ export interface RememberRuntimeLinkedCssSourcesOptions {
5
+ bundleFiles: string[];
6
+ defaultStyleOutputExtension: string;
7
+ debug: (message: string, ...args: unknown[]) => void;
8
+ getConfiguredTailwindV4CssSourceEntries: () => Array<{
9
+ file: string;
10
+ source: string;
11
+ }>;
12
+ getSourceCandidateSource?: ((file: string) => string | undefined) | undefined;
13
+ getSourceCandidateSources?: (() => Iterable<[string, string]>) | undefined;
14
+ isWebGeneratorTarget: boolean;
15
+ jsImportedCssFiles: Set<string>;
16
+ opts: Pick<InternalUserDefinedOptions, 'cssMatcher' | 'platform'>;
17
+ outDir: string;
18
+ rememberCssSource?: ((source: RememberedCssSource) => void) | undefined;
19
+ rootDir: string;
20
+ runtimeLinkedCssFiles: Set<string>;
21
+ shouldPreserveAppCssExtension: boolean;
22
+ snapshot: BundleSnapshot;
23
+ sourceRoot?: string | undefined;
24
+ }
25
+ export declare function rememberRuntimeLinkedCssSources(options: RememberRuntimeLinkedCssSourcesOptions): void;
@@ -0,0 +1,9 @@
1
+ export interface ResolveCurrentSourceCandidateSourceOptions {
2
+ file: string;
3
+ getSourceCandidateSource?: ((file: string) => string | undefined) | undefined;
4
+ getSourceCandidateSources?: (() => Iterable<[string, string]> | undefined) | undefined;
5
+ outDir: string;
6
+ rootDir: string;
7
+ sourceRoot?: string | undefined;
8
+ }
9
+ export declare function resolveCurrentSourceCandidateSource(options: ResolveCurrentSourceCandidateSourceOptions): string | undefined;
@@ -0,0 +1,9 @@
1
+ export interface TailwindV4GenerationCssSourceEntry {
2
+ file: string;
3
+ source: string;
4
+ }
5
+ export declare function collectTailwindV4SourceFingerprint(source: string): Set<string>;
6
+ export declare function scoreConfiguredTailwindV4SourceForRawSource(rawSource: string | undefined, entrySource: string): number;
7
+ export declare function resolveSubpackageRootForFile(file: string | undefined, subpackageRoots: Set<string> | undefined): string | undefined;
8
+ export declare function isSameSubpackageScope(outputFile: string, sourceFile: string | undefined, subpackageRoots: Set<string> | undefined): boolean;
9
+ export declare function selectTailwindV4GenerationCssSourceForOutput<T extends TailwindV4GenerationCssSourceEntry>(outputFile: string, entries: T[], rawSource?: string, subpackageRoots?: Set<string> | undefined): T | undefined;
@@ -0,0 +1,15 @@
1
+ import type { OutputAsset, OutputChunk } from 'rollup';
2
+ import type { InternalUserDefinedOptions } from '../../../types';
3
+ type TransformMatcher = (id: string) => boolean;
4
+ interface TransformFilter {
5
+ include?: TransformMatcher | undefined;
6
+ exclude?: TransformMatcher | undefined;
7
+ }
8
+ export declare function createTransformFilter(options: InternalUserDefinedOptions['transform'], rootDir: string): {
9
+ include: ((id: string) => boolean) | undefined;
10
+ exclude: ((id: string) => boolean) | undefined;
11
+ } | undefined;
12
+ export declare function shouldSkipViteJsChunkTransform(chunk: OutputChunk, filter: TransformFilter | undefined): boolean;
13
+ export declare function shouldSkipViteAssetTransform(asset: OutputAsset, file: string, rootDir: string, filter: TransformFilter | undefined): boolean;
14
+ export declare function createTransformFilterSignature(options: InternalUserDefinedOptions['transform']): string;
15
+ export {};
@@ -15,6 +15,7 @@ export interface GenerateBundleContext {
15
15
  ensureBundleRuntimeClassSet: (snapshot: BundleSnapshot, forceRefresh?: boolean, options?: {
16
16
  allowBaselineOnlyInitialSync?: boolean | undefined;
17
17
  baseClassSet?: Set<string> | undefined;
18
+ refreshBySource?: boolean | undefined;
18
19
  transformOnly?: boolean | undefined;
19
20
  }) => Promise<Set<string>>;
20
21
  debug: (format: string, ...args: unknown[]) => void;
@@ -3,7 +3,6 @@ import type { GenerateBundleContext, GenerateBundleThis } from './generate-bundl
3
3
  export { normalizeBundleFileNameKeysForTest } from './generate-bundle/bundle-file-names';
4
4
  export { resolveMiniProgramStyleOutputExtension, resolveReplayCssOutputFile, resolveReplayCssOutputFileFromSourceRoot, resolveViteCssPipelineOutputFile, resolveViteCssPipelineOutputFileFromSourceFile } from './generate-bundle/css-output';
5
5
  export { resolveRememberedCssSourceForTest } from './generate-bundle/remembered-css';
6
+ export { shouldKeepRootMiniProgramStyleAsImportShell, shouldMoveRootMiniProgramStyleToImportShellOrigin } from './generate-bundle/root-style-output';
6
7
  export type { GenerateBundleContext, GenerateBundleThis, RememberedCssSource } from './generate-bundle/types';
7
- export declare function shouldKeepRootMiniProgramStyleAsImportShell(appType: unknown): appType is "uni-app-x" | "taro" | "uni-app-vite";
8
- export declare function shouldMoveRootMiniProgramStyleToImportShellOrigin(appType: unknown): appType is "taro";
9
8
  export declare function createGenerateBundleHook(context: GenerateBundleContext): (this: GenerateBundleThis, _opt: unknown, bundle: Record<string, OutputAsset | OutputChunk>) => Promise<void>;
@@ -0,0 +1,15 @@
1
+ export declare function isMissingInternalCssSource(file: string, packageDir: string): boolean;
2
+ export declare function normalizeVitePersistentCacheKey(file: string): string;
3
+ export declare function toMb(bytes: number): number;
4
+ export declare function summarizeStringCache(map: Map<string, string>): {
5
+ bytes: number;
6
+ mb: number;
7
+ size: number;
8
+ };
9
+ export declare function summarizeViteProcessedCssResults(map: Map<string, {
10
+ css: string;
11
+ }>): {
12
+ bytes: number;
13
+ mb: number;
14
+ size: number;
15
+ };
@@ -17,9 +17,10 @@ export declare function createViteRuntimeClassSet(options: CreateViteRuntimeClas
17
17
  };
18
18
  refreshRuntimeState: (force: boolean) => Promise<void>;
19
19
  ensureRuntimeClassSet: (force?: boolean) => Promise<Set<string>>;
20
- ensureBundleRuntimeClassSet: (snapshot: BundleSnapshot, forceRefresh?: boolean, _options?: {
20
+ ensureBundleRuntimeClassSet: (snapshot: BundleSnapshot, forceRefresh?: boolean, options?: {
21
21
  allowBaselineOnlyInitialSync?: boolean | undefined;
22
22
  baseClassSet?: Set<string> | undefined;
23
+ refreshBySource?: boolean | undefined;
23
24
  transformOnly?: boolean | undefined;
24
25
  }) => Promise<Set<string>>;
25
26
  };
@@ -7,10 +7,10 @@ export declare function hasLoaderEntry(entries: Array<{
7
7
  }>, target?: string): boolean;
8
8
  interface ChunkLike {
9
9
  id?: string | number | null;
10
- name?: string;
10
+ name?: string | undefined;
11
11
  hash?: string | null;
12
- files?: Iterable<string> | Array<string>;
13
- hasRuntime?: () => boolean;
12
+ files?: Iterable<string> | Array<string> | undefined;
13
+ hasRuntime?: (() => boolean) | undefined;
14
14
  }
15
15
  interface ModuleLike {
16
16
  context?: string;
@@ -0,0 +1,34 @@
1
+ import type { SetupWebpackV5ProcessAssetsHookOptions } from './helpers';
2
+ import type { WebpackCssHandlerOptions } from './pipeline-helpers';
3
+ export declare function createWebpackCssSourceResolvers(options: {
4
+ activeWebpackAssetResourceFiles: ReadonlySet<string>;
5
+ appType: SetupWebpackV5ProcessAssetsHookOptions['appType'];
6
+ compilerOptions: SetupWebpackV5ProcessAssetsHookOptions['options'];
7
+ compilation: {
8
+ chunks: Iterable<{
9
+ files?: Iterable<string> | string[] | undefined;
10
+ hasRuntime?: () => boolean;
11
+ name?: string | undefined;
12
+ }>;
13
+ };
14
+ cssAssetResources: ReadonlyMap<string, ReadonlySet<string>>;
15
+ cssHandlerOptionsCache: Map<string, WebpackCssHandlerOptions>;
16
+ cssSources: Map<string, {
17
+ css: string | undefined;
18
+ processed?: boolean | undefined;
19
+ }>;
20
+ cssUserHandlerOptionsCache: Map<string, WebpackCssHandlerOptions>;
21
+ groupedCssEntriesLength: number;
22
+ singleCssAssetFile?: string | undefined;
23
+ isWebGeneratorTarget: boolean;
24
+ outputDir: string;
25
+ runtimeState: SetupWebpackV5ProcessAssetsHookOptions['runtimeState'];
26
+ }): {
27
+ activeWebpackCssSourceFiles: Set<string>;
28
+ configuredMainCssEntryFiles: string[];
29
+ getCssHandlerOptions: (file: string, rawSource?: string | undefined) => WebpackCssHandlerOptions;
30
+ getCssUserHandlerOptions: (file: string) => WebpackCssHandlerOptions;
31
+ hasConfiguredTailwindV4SourceRoots: () => boolean;
32
+ isSameWebpackSourceScope: (outputFile: string, candidateSourceFile: string, currentSourceFile?: string | undefined) => boolean;
33
+ resolveWebpackCssSourceFile: (file: string, rawSource?: string | undefined) => string | undefined;
34
+ };
@@ -0,0 +1,37 @@
1
+ import type { sources as WebpackSources } from 'webpack';
2
+ import type { SetupWebpackV5ProcessAssetsHookOptions } from './helpers';
3
+ import type { LinkedJsModuleResult } from '../../../../types';
4
+ export declare function createWebpackJsAssetModuleGraph(options: {
5
+ compilation: {
6
+ getAsset: (file: string) => {
7
+ source: {
8
+ source: () => unknown;
9
+ };
10
+ } | undefined;
11
+ };
12
+ compilerOptions: SetupWebpackV5ProcessAssetsHookOptions['options'];
13
+ entries: Array<[string, unknown]>;
14
+ outputDir: string;
15
+ }): {
16
+ jsAssets: Map<string, string>;
17
+ moduleGraphOptions: {
18
+ resolve(specifier: string, importer: string): string | undefined;
19
+ load: (id: string) => string | undefined;
20
+ filter(id: string): boolean;
21
+ };
22
+ };
23
+ export declare function applyWebpackLinkedJsResults(options: {
24
+ ConcatSource: new (code: string) => WebpackSources.Source;
25
+ compilation: {
26
+ getAsset: (file: string) => {
27
+ source: {
28
+ source: () => unknown;
29
+ };
30
+ } | undefined;
31
+ updateAsset: (file: string, source: WebpackSources.Source) => void;
32
+ };
33
+ compilerOptions: SetupWebpackV5ProcessAssetsHookOptions['options'];
34
+ debug: SetupWebpackV5ProcessAssetsHookOptions['debug'];
35
+ jsAssets: ReadonlyMap<string, string>;
36
+ linked: Record<string, LinkedJsModuleResult> | undefined;
37
+ }): void;
@@ -0,0 +1,199 @@
1
+ import type { TailwindV4CssSource } from '../../../shared/generator-css/source-resolver/types';
2
+ import type { createEscapeFragments } from '../../../vite/incremental-runtime-class-set/escaped-candidates';
3
+ import type { SourceCandidateStore } from '../../../vite/source-candidates';
4
+ import type { SetupWebpackV5ProcessAssetsHookOptions, WebpackSourceLike } from './helpers';
5
+ import type { WebpackSourceCandidateScanMemoryStats } from './source-candidate-cache';
6
+ import type { TailwindcssRuntimeLike } from '../../../../types';
7
+ export interface WebpackCssHandlerOptions {
8
+ isMainChunk: boolean;
9
+ postcssOptions: {
10
+ options: {
11
+ from: string;
12
+ };
13
+ };
14
+ majorVersion?: 4 | undefined;
15
+ sourceOptions?: {
16
+ cssSources?: TailwindV4CssSource[] | undefined;
17
+ outputRoot?: string | undefined;
18
+ sourceCss?: string | undefined;
19
+ sourceFile?: string | undefined;
20
+ } | undefined;
21
+ }
22
+ export declare function removeTailwindV4StandaloneHostPreflightRule(source: string): string;
23
+ export interface WebpackSourceCandidateCache {
24
+ getSourceCandidatesForEntries: SourceCandidateStore['valuesForEntries'];
25
+ signatureHash: string;
26
+ tokenSources: ReturnType<SourceCandidateStore['sourcesForEntries']>;
27
+ }
28
+ export declare function isRuntimeTransformCandidate(candidate: string): boolean;
29
+ export declare function collectRuntimeTokenSignatureParts(source: string): [] | RegExpMatchArray;
30
+ export declare function hasMissingRuntimeCandidates(classSet: ReadonlySet<string> | undefined, candidates: ReadonlySet<string> | undefined): boolean;
31
+ export declare function resolveGeneratedCssRuntimeCandidates(source: string, fallbackClassSet?: ReadonlySet<string> | undefined): ReadonlySet<string>;
32
+ export declare function getRuntimeClassSetSync(tailwindRuntime: TailwindcssRuntimeLike): Set<string>;
33
+ export declare function toMb(bytes: number): number;
34
+ export declare function pruneMapToMaxSize<Key, Value>(map: Map<Key, Value>, maxSize: number): void;
35
+ export declare function stripTrailingLineWhitespace(source: string): string;
36
+ export declare function pruneWebpackCssHandlerOptionCaches(cssHandlerOptionsCache: Map<string, WebpackCssHandlerOptions>, cssUserHandlerOptionsCache: Map<string, WebpackCssHandlerOptions>, activeCssFiles: Set<string>): void;
37
+ export declare function resolveWebpackGeneratorRawSource(rawSource: string, cssHandlerOptions: WebpackCssHandlerOptions): string;
38
+ export interface WebpackGeneratorUserCssSource {
39
+ css: string;
40
+ processed: boolean;
41
+ }
42
+ export declare function hasUsableWebpackGeneratorCssSources(cssSources: TailwindV4CssSource[] | undefined): cssSources is TailwindV4CssSource[];
43
+ export declare function normalizeWebpackGeneratorCssSources(cssSources: TailwindV4CssSource[] | undefined): import("@tailwindcss-mangle/engine").TailwindV4CssSource[] | undefined;
44
+ export declare function hasProcessedCssAssetUrl(css: string): boolean;
45
+ export declare function shouldUseWebpackAssetAsGeneratorUserCss(rawSource: string, generatorRawSource: string, options?: {
46
+ processed?: boolean | undefined;
47
+ }): boolean;
48
+ export declare function collectWebpackAssetUserCssMarkers(source: string): Set<string>;
49
+ export declare function parseWebpackCssLayerNames(params: string): string[];
50
+ export declare function removeWebpackTailwindGeneratedAssetCss(source: string): string;
51
+ export declare function collectWebpackCssRuleIdentityMarkers(source: string): Set<string>;
52
+ export declare function unescapeCssIdentifier(value: string): string;
53
+ export declare function collectGeneratedCssRuntimeCandidates(source: string): Set<string>;
54
+ export declare function hasAdditionalWebpackAssetUserCssMarkers(rawSource: string, generatorRawSource: string): boolean;
55
+ export declare function hasWebpackTailwindSourceDirectives(source: string | undefined): boolean;
56
+ export declare function isWebpackTailwindImportRequest(request: string | undefined): boolean | undefined;
57
+ export declare function removeWebpackGeneratorNonTailwindImports(source: string | undefined): string | undefined;
58
+ export declare function isWebpackCssSourceRepresentedInAsset(rawSource: string, sourceCss: string | undefined): boolean;
59
+ export declare function createWebpackGeneratorCssSource(file: string | undefined, css: string | undefined): {
60
+ file: string;
61
+ base: string;
62
+ css: string;
63
+ dependencies: string[];
64
+ } | undefined;
65
+ export declare function createWebpackUserCssSourceAppend(sources: Iterable<{
66
+ css: string | undefined;
67
+ file: string;
68
+ processed?: boolean | undefined;
69
+ }>, generatorRawSource: string, currentSourceFile?: string | undefined, shouldIncludeSource?: ((file: string) => boolean) | undefined): {
70
+ css: string;
71
+ processed: boolean;
72
+ } | undefined;
73
+ export declare function createWebpackGeneratorUserCssSourceAppend(...sources: Array<WebpackGeneratorUserCssSource | undefined>): WebpackGeneratorUserCssSource | undefined;
74
+ export declare function resolveWebpackMemoryDebugStats(context: {
75
+ activeAssetFiles: number;
76
+ activeCssFiles: number;
77
+ activeProcessCacheKeys: Set<string>;
78
+ activeProcessHashKeys: Set<string | number>;
79
+ cache: SetupWebpackV5ProcessAssetsHookOptions['options']['cache'];
80
+ cssHandlerOptionsCache: Map<string, WebpackCssHandlerOptions>;
81
+ cssUserHandlerOptionsCache: Map<string, WebpackCssHandlerOptions>;
82
+ phase: string;
83
+ sourceCandidateScan: WebpackSourceCandidateScanMemoryStats;
84
+ }): {
85
+ phase: string;
86
+ process: {
87
+ rssMb: number;
88
+ heapTotalMb: number;
89
+ heapUsedMb: number;
90
+ externalMb: number;
91
+ arrayBuffersMb: number;
92
+ };
93
+ assets: {
94
+ active: number;
95
+ activeCss: number;
96
+ };
97
+ processCache: {
98
+ instance: number;
99
+ hashMap: number;
100
+ activeCacheKeys: number;
101
+ activeHashKeys: number;
102
+ staleCacheKeys: number;
103
+ staleHashKeys: number;
104
+ pruned: boolean;
105
+ pruneSkipped: boolean;
106
+ };
107
+ webpackCss: {
108
+ handlerOptions: number;
109
+ userHandlerOptions: number;
110
+ maxHandlerOptions: number;
111
+ };
112
+ sourceCandidateScan: WebpackSourceCandidateScanMemoryStats;
113
+ tailwind: {
114
+ v4: {
115
+ max: number;
116
+ entryCandidatesMax: number;
117
+ entryCssBytesMax: number;
118
+ size: number;
119
+ taskMax: number;
120
+ taskSize: number;
121
+ entries: {
122
+ candidates: number;
123
+ classSet: number;
124
+ cssBytes: number;
125
+ rawCssBytes: number;
126
+ keyHash: string;
127
+ keyBytes: number;
128
+ }[];
129
+ keys: {
130
+ keyHash: string;
131
+ keyBytes: number;
132
+ }[];
133
+ taskKeys: {
134
+ keyHash: string;
135
+ keyBytes: number;
136
+ }[];
137
+ };
138
+ };
139
+ } | undefined;
140
+ export declare function shouldInjectWebpackCssTracePreflight(appType: SetupWebpackV5ProcessAssetsHookOptions['appType'], cssHandlerOptions: Pick<WebpackCssHandlerOptions, 'isMainChunk'>): boolean;
141
+ export declare function finalizeMiniProgramUserCssAssetSource(source: string, compilerOptions: SetupWebpackV5ProcessAssetsHookOptions['options'], isWebGeneratorTarget: boolean, options?: {
142
+ cssPreflight?: boolean | undefined;
143
+ }): string;
144
+ export declare function shouldFallbackToWebpackUserCssOnGeneratorError(options: {
145
+ configuredMainCssEntryFilesLength: number;
146
+ generatorRawSource: string;
147
+ hasExplicitTailwindV4SourceCss: boolean;
148
+ }): boolean;
149
+ export declare function resolveWebpackCssAssetModuleResource(resource: string, issuer: {
150
+ context?: string;
151
+ resource?: string;
152
+ } | undefined, options: {
153
+ appType?: SetupWebpackV5ProcessAssetsHookOptions['appType'] | undefined;
154
+ cssMatcher: (file: string) => boolean;
155
+ }): string | undefined;
156
+ export declare function isSameWebpackCssSourceScope(options: {
157
+ candidateSourceFile: string;
158
+ currentSourceFile?: string | undefined;
159
+ outputFile: string;
160
+ resourcesByAsset: ReadonlyMap<string, ReadonlySet<string>>;
161
+ }): boolean;
162
+ export declare function shouldAppendCurrentWebpackAssetUserCss(options: {
163
+ currentAssetHasBundlerGeneratedMarker: boolean;
164
+ currentAssetHasUserCss: boolean;
165
+ currentAssetLooksGenerated: boolean;
166
+ registeredUserRawSource: WebpackGeneratorUserCssSource | undefined;
167
+ shouldPreserveGeneratedWebAssetUserCss: boolean;
168
+ sourceCssProcessed: boolean;
169
+ }): boolean;
170
+ export declare function createWebpackCurrentAssetUserRawSource(options: {
171
+ currentAssetHasUserCss: boolean;
172
+ currentAssetLooksGenerated: boolean;
173
+ currentAssetUserCssSource: string;
174
+ shouldAppendCurrentAssetUserCss: boolean;
175
+ sourceCssProcessed: boolean;
176
+ }): WebpackGeneratorUserCssSource | undefined;
177
+ export declare function finalizeTracedWebpackCssAsset(css: string, cssHandlerOptions: WebpackCssHandlerOptions, options: {
178
+ annotateCss: (css: string) => string;
179
+ compilerOptions: SetupWebpackV5ProcessAssetsHookOptions['options'];
180
+ isWebGeneratorTarget: boolean;
181
+ }): string;
182
+ export declare function finalizeWebpackCssAssetSource(source: string, compilerOptions: SetupWebpackV5ProcessAssetsHookOptions['options'], isWebGeneratorTarget: boolean, options?: {
183
+ generatedCss?: boolean;
184
+ }): string;
185
+ export declare function collectWebpackJsRuntimeCandidatesFromAssets(options: {
186
+ escapeFragments: ReturnType<typeof createEscapeFragments>;
187
+ getAssetSource: (file: string) => WebpackSourceLike | undefined;
188
+ isWebGeneratorTarget: boolean;
189
+ jsAssets: Iterable<string>;
190
+ }): Set<string> | undefined;
191
+ export declare function collectWebpackJsRuntimeTokenSignature(options: {
192
+ getAssetSource: (file: string) => WebpackSourceLike | undefined;
193
+ isWebGeneratorTarget: boolean;
194
+ jsAssets: Iterable<string>;
195
+ }): string;
196
+ export declare function addRuntimeTransformCandidates(target: Set<string>, candidates: ReadonlySet<string> | undefined): void;
197
+ export declare function createWebpackCssSourceTraceTokenSources(compilerOptions: SetupWebpackV5ProcessAssetsHookOptions['options'], webpackSourceCandidates: WebpackSourceCandidateCache | undefined): import("../../../shared/css-source-trace").CssTokenSourceMap | undefined;
198
+ export declare function stringifyOptionalWebpackSourceValue(value: unknown): string;
199
+ export declare function stringifyWebpackSourceLike(source: WebpackSourceLike): string;