weapp-tailwindcss 5.0.11 → 5.0.13

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 (109) hide show
  1. package/dist/{bundle-state-BwtEqxvU.js → bundle-state-CKWeTEhv.js} +2 -40
  2. package/dist/{bundle-state-CXzPknlT.mjs → bundle-state-zQ2MrDdi.mjs} +2 -34
  3. package/dist/bundlers/gulp/vinyl-transform.d.ts +1 -1
  4. package/dist/bundlers/shared/generator-css/generation-helpers.d.ts +7 -2
  5. package/dist/bundlers/shared/generator-css/source-files.d.ts +1 -0
  6. package/dist/bundlers/shared/generator-css/source-resolver/apply-reference.d.ts +3 -0
  7. package/dist/bundlers/shared/generator-css/source-resolver/config.d.ts +7 -0
  8. package/dist/bundlers/shared/generator-css/source-resolver/matching.d.ts +4 -0
  9. package/dist/bundlers/shared/generator-css/source-resolver/metadata.d.ts +15 -0
  10. package/dist/bundlers/shared/generator-css/source-resolver/postcss-source.d.ts +12 -0
  11. package/dist/bundlers/shared/generator-css/source-resolver/types.d.ts +22 -0
  12. package/dist/bundlers/shared/generator-css/source-resolver.d.ts +5 -22
  13. package/dist/bundlers/shared/generator-css/types.d.ts +2 -0
  14. package/dist/bundlers/shared/generator-css/validate.d.ts +1 -0
  15. package/dist/bundlers/shared/hmr-timing.d.ts +1 -0
  16. package/dist/bundlers/vite/css-memory.d.ts +27 -0
  17. package/dist/bundlers/vite/generate-bundle/bundle-file-names.d.ts +2 -0
  18. package/dist/bundlers/vite/generate-bundle/configured-css-sources.d.ts +8 -0
  19. package/dist/bundlers/vite/generate-bundle/css-assets.d.ts +4 -0
  20. package/dist/bundlers/vite/generate-bundle/css-handler-options.d.ts +5 -0
  21. package/dist/bundlers/vite/generate-bundle/css-output.d.ts +9 -7
  22. package/dist/bundlers/vite/generate-bundle/env-flags.d.ts +7 -0
  23. package/dist/bundlers/vite/generate-bundle/finalize.d.ts +58 -0
  24. package/dist/bundlers/vite/generate-bundle/js-processing.d.ts +31 -0
  25. package/dist/bundlers/vite/generate-bundle/memory-debug.d.ts +77 -0
  26. package/dist/bundlers/vite/generate-bundle/remembered-css-replay.d.ts +53 -0
  27. package/dist/bundlers/vite/generate-bundle/remembered-css.d.ts +1 -1
  28. package/dist/bundlers/vite/generate-bundle/runtime-linked-css.d.ts +4 -0
  29. package/dist/bundlers/vite/generate-bundle/scoped-generator.d.ts +21 -0
  30. package/dist/bundlers/vite/generate-bundle/sfc-style-source.d.ts +2 -1
  31. package/dist/bundlers/vite/generate-bundle/source-candidate-scope.d.ts +29 -0
  32. package/dist/bundlers/vite/generate-bundle/timing.d.ts +1 -0
  33. package/dist/bundlers/vite/generate-bundle/types.d.ts +7 -0
  34. package/dist/bundlers/vite/generate-bundle/uni-app-x-postprocess.d.ts +20 -0
  35. package/dist/bundlers/vite/generate-bundle/vite-css-cache.d.ts +6 -0
  36. package/dist/bundlers/vite/generate-bundle.d.ts +2 -1
  37. package/dist/bundlers/vite/hot-css-modules.d.ts +5 -0
  38. package/dist/bundlers/vite/map-cache.d.ts +2 -0
  39. package/dist/bundlers/vite/processed-css-assets.d.ts +16 -0
  40. package/dist/bundlers/vite/resolve-app-type.d.ts +1 -2
  41. package/dist/bundlers/vite/source-candidate-scan-signature.d.ts +13 -0
  42. package/dist/bundlers/vite/source-candidates.d.ts +9 -0
  43. package/dist/bundlers/vite/source-scan/css-entries.d.ts +1 -0
  44. package/dist/bundlers/vite/source-scan.d.ts +1 -1
  45. package/dist/bundlers/vite/weapp-vite-config.d.ts +3 -0
  46. package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets/helpers.d.ts +11 -8
  47. package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-loaders.d.ts +2 -0
  48. package/dist/bundlers/webpack/loaders/runtime-registry.d.ts +5 -0
  49. package/dist/cache/index.d.ts +4 -0
  50. package/dist/cli.js +9 -2
  51. package/dist/cli.mjs +8 -1
  52. package/dist/core.d.ts +7 -0
  53. package/dist/core.js +8 -5
  54. package/dist/core.mjs +8 -5
  55. package/dist/css-macro.js +1 -1
  56. package/dist/css-macro.mjs +1 -1
  57. package/dist/{defaults-DH0ZQRhy.mjs → defaults-Bqx18S1f.mjs} +2 -35
  58. package/dist/{defaults-Boc26eel.js → defaults-C_J_kBpw.js} +2 -35
  59. package/dist/defaults.js +1 -1
  60. package/dist/defaults.mjs +1 -1
  61. package/dist/framework/index.d.ts +59 -0
  62. package/dist/framework.d.ts +1 -0
  63. package/dist/framework.js +198 -0
  64. package/dist/framework.mjs +180 -0
  65. package/dist/{generator-ChgOWNOj.js → generator-CzpArpCL.js} +1 -1
  66. package/dist/{generator-h2XRiJ9-.mjs → generator-ITLd7PTl.mjs} +1 -1
  67. package/dist/generator.js +2 -2
  68. package/dist/generator.mjs +2 -2
  69. package/dist/{gulp-Be88jhoY.mjs → gulp-DfOQERcV.mjs} +137 -23
  70. package/dist/{gulp-CHtZF-oT.js → gulp-XT8Jc7lH.js} +137 -23
  71. package/dist/gulp.js +1 -1
  72. package/dist/gulp.mjs +1 -1
  73. package/dist/{hmr-timing-BkivBZvN.js → hmr-timing-BMftW7Us.js} +354 -225
  74. package/dist/{hmr-timing-Ct5w4hdM.mjs → hmr-timing-DQIP_8qP.mjs} +341 -225
  75. package/dist/index.d.ts +1 -0
  76. package/dist/index.js +20 -4
  77. package/dist/index.mjs +6 -5
  78. package/dist/postcss.js +9 -10
  79. package/dist/postcss.mjs +7 -5
  80. package/dist/{precheck-CY9oaH49.js → precheck-B0Z8yW7E.js} +108 -27
  81. package/dist/{precheck-BpHxsWRd.mjs → precheck-CRI90iL1.mjs} +109 -28
  82. package/dist/presets.js +3 -3
  83. package/dist/presets.mjs +3 -3
  84. package/dist/tailwindcss/source-scan.d.ts +1 -0
  85. package/dist/tailwindcss/v3-engine/generator.d.ts +17 -0
  86. package/dist/tailwindcss/v3-engine/index.d.ts +1 -1
  87. package/dist/tailwindcss/v3-engine/types.d.ts +1 -0
  88. package/dist/tailwindcss/v4-engine/generator.d.ts +19 -0
  89. package/dist/tailwindcss/v4-engine/index.d.ts +1 -1
  90. package/dist/{tailwindcss-Bfy2egdX.mjs → tailwindcss-DTq3uYBK.mjs} +2 -2
  91. package/dist/{tailwindcss-DbbAKAZP.js → tailwindcss-DZEwT3C_.js} +3 -3
  92. package/dist/{transform-r5evL6Hn.mjs → transform-DfcEjsZF.mjs} +29 -21
  93. package/dist/{transform-Cd634UZV.js → transform-YmrmxuF3.js} +29 -21
  94. package/dist/types/user-defined-options/general.d.ts +3 -1
  95. package/dist/{utils-Dolmt8EO.js → utils-BCa37Wqj.js} +2 -17
  96. package/dist/{utils-DsaS975I.mjs → utils-DodxWHGz.mjs} +2 -17
  97. package/dist/{v3-engine-D0yA9ZkF.js → v3-engine-2rrgylhn.js} +194 -34
  98. package/dist/{v3-engine-CFkP6dWF.mjs → v3-engine-C6eJ0YzK.mjs} +176 -34
  99. package/dist/{vite-j9cB2Ff1.js → vite-CXHVsHmX.js} +2071 -1160
  100. package/dist/{vite-Bd8qf9dK.mjs → vite-DjI09vVN.mjs} +2071 -1160
  101. package/dist/vite.js +1 -1
  102. package/dist/vite.mjs +1 -1
  103. package/dist/weapp-tw-css-import-rewrite-loader.js +476 -217
  104. package/dist/weapp-tw-runtime-classset-loader.js +25 -0
  105. package/dist/{webpack-DPdrcC2X.mjs → webpack-BcPpnT90.mjs} +251 -40
  106. package/dist/{webpack-CJAOcYEO.js → webpack-CfkUkMXG.js} +254 -43
  107. package/dist/webpack.js +1 -1
  108. package/dist/webpack.mjs +1 -1
  109. package/package.json +10 -5
@@ -1,10 +1,10 @@
1
1
  const require_chunk = require("./chunk-emK7D4bc.js");
2
- const require_precheck = require("./precheck-CY9oaH49.js");
3
- let node_module = require("node:module");
2
+ const require_precheck = require("./precheck-B0Z8yW7E.js");
4
3
  let node_path = require("node:path");
5
4
  node_path = require_chunk.__toESM(node_path);
6
5
  let node_process = require("node:process");
7
6
  node_process = require_chunk.__toESM(node_process);
7
+ let node_module = require("node:module");
8
8
  let _weapp_tailwindcss_shared = require("@weapp-tailwindcss/shared");
9
9
  let node_buffer = require("node:buffer");
10
10
  //#region src/bundlers/shared/module-graph.ts
@@ -150,38 +150,6 @@ function parseBundlerGeneratedCssMarkerBlocks(source) {
150
150
  return blocks;
151
151
  }
152
152
  //#endregion
153
- //#region src/bundlers/shared/run-tasks.ts
154
- async function runWithConcurrency(factories, limit = Math.min(4, Math.max(1, factories.length))) {
155
- if (factories.length === 0) return [];
156
- const results = Array.from({ length: factories.length });
157
- const executing = /* @__PURE__ */ new Set();
158
- let cursor = 0;
159
- const effectiveLimit = Math.max(1, limit);
160
- const scheduleNext = () => {
161
- if (cursor >= factories.length) return;
162
- const currentIndex = cursor++;
163
- const factory = factories[currentIndex];
164
- if (!factory) return;
165
- const wrapped = Promise.resolve(factory()).then((value) => {
166
- results[currentIndex] = value;
167
- }).finally(() => {
168
- executing.delete(wrapped);
169
- });
170
- executing.add(wrapped);
171
- };
172
- while (cursor < factories.length && executing.size < effectiveLimit) scheduleNext();
173
- while (cursor < factories.length) {
174
- await Promise.race(executing);
175
- scheduleNext();
176
- }
177
- await Promise.all(executing);
178
- return results;
179
- }
180
- function pushConcurrentTaskFactories(queue, factories, limit) {
181
- if (factories.length === 0) return;
182
- queue.push(runWithConcurrency(factories, limit).then(() => void 0));
183
- }
184
- //#endregion
185
153
  //#region src/bundlers/vite/bundle-entries.ts
186
154
  function readOutputEntry(entry) {
187
155
  if (entry.output.type === "chunk") return entry.output.code;
@@ -512,12 +480,6 @@ Object.defineProperty(exports, "parseBundlerGeneratedCssMarkerBlocks", {
512
480
  return parseBundlerGeneratedCssMarkerBlocks;
513
481
  }
514
482
  });
515
- Object.defineProperty(exports, "pushConcurrentTaskFactories", {
516
- enumerable: true,
517
- get: function() {
518
- return pushConcurrentTaskFactories;
519
- }
520
- });
521
483
  Object.defineProperty(exports, "resolveOutputSpecifier", {
522
484
  enumerable: true,
523
485
  get: function() {
@@ -1,4 +1,4 @@
1
- import { h as traverse, m as babelParse, o as Parser } from "./precheck-BpHxsWRd.mjs";
1
+ import { h as traverse, m as babelParse, o as Parser } from "./precheck-CRI90iL1.mjs";
2
2
  import { createRequire } from "node:module";
3
3
  import path from "node:path";
4
4
  import process from "node:process";
@@ -147,38 +147,6 @@ function parseBundlerGeneratedCssMarkerBlocks(source) {
147
147
  return blocks;
148
148
  }
149
149
  //#endregion
150
- //#region src/bundlers/shared/run-tasks.ts
151
- async function runWithConcurrency(factories, limit = Math.min(4, Math.max(1, factories.length))) {
152
- if (factories.length === 0) return [];
153
- const results = Array.from({ length: factories.length });
154
- const executing = /* @__PURE__ */ new Set();
155
- let cursor = 0;
156
- const effectiveLimit = Math.max(1, limit);
157
- const scheduleNext = () => {
158
- if (cursor >= factories.length) return;
159
- const currentIndex = cursor++;
160
- const factory = factories[currentIndex];
161
- if (!factory) return;
162
- const wrapped = Promise.resolve(factory()).then((value) => {
163
- results[currentIndex] = value;
164
- }).finally(() => {
165
- executing.delete(wrapped);
166
- });
167
- executing.add(wrapped);
168
- };
169
- while (cursor < factories.length && executing.size < effectiveLimit) scheduleNext();
170
- while (cursor < factories.length) {
171
- await Promise.race(executing);
172
- scheduleNext();
173
- }
174
- await Promise.all(executing);
175
- return results;
176
- }
177
- function pushConcurrentTaskFactories(queue, factories, limit) {
178
- if (factories.length === 0) return;
179
- queue.push(runWithConcurrency(factories, limit).then(() => void 0));
180
- }
181
- //#endregion
182
150
  //#region src/bundlers/vite/bundle-entries.ts
183
151
  function readOutputEntry(entry) {
184
152
  if (entry.output.type === "chunk") return entry.output.code;
@@ -431,4 +399,4 @@ function updateBundleBuildState(state, snapshot, linkedByEntry, options = {}) {
431
399
  state.dependentsByLinkedFile = invertLinkedByEntry(state.linkedByEntry);
432
400
  }
433
401
  //#endregion
434
- export { toAbsoluteOutputPath as C, resolveOutputSpecifier as S, normalizePath as _, applyLinkedResults as a, stripRequestQuery as b, createBundlerGeneratedCssMarker as c, stripBundlerGeneratedCssMarkers as d, resolvePackageDir as f, isCSSRequest as g, formatPostcssSourceMap as h, createRuntimeAffectingSourceSignature as i, hasBundlerGeneratedCssMarker as l, cleanUrl as m, createBundleBuildState as n, createBundleModuleGraphOptions as o, resolvePluginDisabledState as p, updateBundleBuildState as r, pushConcurrentTaskFactories as s, buildBundleSnapshot as t, parseBundlerGeneratedCssMarkerBlocks as u, slash as v, normalizeOutputPathKey as x, isSourceStyleRequest as y };
402
+ export { toAbsoluteOutputPath as S, slash as _, applyLinkedResults as a, normalizeOutputPathKey as b, hasBundlerGeneratedCssMarker as c, resolvePackageDir as d, resolvePluginDisabledState as f, normalizePath as g, isCSSRequest as h, createRuntimeAffectingSourceSignature as i, parseBundlerGeneratedCssMarkerBlocks as l, formatPostcssSourceMap as m, createBundleBuildState as n, createBundleModuleGraphOptions as o, cleanUrl as p, updateBundleBuildState as r, createBundlerGeneratedCssMarker as s, buildBundleSnapshot as t, stripBundlerGeneratedCssMarkers as u, isSourceStyleRequest as v, resolveOutputSpecifier as x, stripRequestQuery as y };
@@ -1,3 +1,3 @@
1
1
  import type File from 'vinyl';
2
2
  import stream from 'node:stream';
3
- export declare function createVinylTransform(phase: string, handler: (file: File) => Promise<void>): stream.Transform;
3
+ export declare function createVinylTransform(phase: string, handler: (file: File) => Promise<void>, getTimingDetails?: ((file: File) => Record<string, unknown> | undefined) | undefined): stream.Transform;
@@ -5,6 +5,7 @@ import type { TailwindSourceEntry } from '../../../tailwindcss/source-scan';
5
5
  import type { InternalUserDefinedOptions } from '../../../types';
6
6
  export declare function finalizeMiniProgramGeneratorCss(css: string, target: string, majorVersion: number | undefined, cssPreflight: InternalUserDefinedOptions['cssPreflight'], options?: {
7
7
  injectPreflight?: boolean;
8
+ styleOptions?: Partial<IStyleHandlerOptions> | undefined;
8
9
  }): string;
9
10
  export declare function shouldInjectMiniProgramPreflightForGeneratorCss(opts: InternalUserDefinedOptions, options: {
10
11
  cssHandlerOptions: IStyleHandlerOptions;
@@ -15,9 +16,13 @@ export declare function mergeScopedRuntimeWithCurrentRuntime(scopedRuntime: Set<
15
16
  currentCssCandidates?: string[] | undefined;
16
17
  cssHandlerOptions: IStyleHandlerOptions;
17
18
  isolateCssSource: boolean;
19
+ majorVersion?: number | undefined;
18
20
  matchedCssSourceFile: boolean;
19
21
  }): Set<string>;
20
- export declare function shouldIsolateScopedCssSource(source: GeneratorResolvedSource, sourceEntries: TailwindSourceEntry[] | undefined): boolean;
22
+ export declare function shouldIsolateScopedCssSource(majorVersion: number | undefined, source: GeneratorResolvedSource, sourceEntries: TailwindSourceEntry[] | undefined, options: {
23
+ cssHandlerOptions?: IStyleHandlerOptions | undefined;
24
+ target: string;
25
+ }): boolean;
21
26
  export declare function shouldIsolateCurrentTailwindV4CssCandidates(majorVersion: number | undefined, cssHandlerOptions: IStyleHandlerOptions, options: {
22
27
  hasGeneratedCss: boolean;
23
28
  hasGeneratedMarkers: boolean;
@@ -39,7 +44,7 @@ export declare function splitRawSourceByGeneratedCssOrder(rawSource: string, raw
39
44
  before: string;
40
45
  after: string;
41
46
  } | undefined;
42
- export declare function shouldUseGeneratorForCurrentCss(majorVersion: number | undefined, cssHandlerOptions: IStyleHandlerOptions, options: {
47
+ export declare function shouldUseGeneratorForCurrentCss(_majorVersion: number | undefined, cssHandlerOptions: IStyleHandlerOptions, options: {
43
48
  hasGeneratedCss: boolean;
44
49
  hasGeneratedMarkers: boolean;
45
50
  hasSourceDirectives: boolean;
@@ -3,6 +3,7 @@ export interface SourceSideCssEntryOptions {
3
3
  cwd?: string | undefined;
4
4
  outputRoot?: string | undefined;
5
5
  sourceFile?: string | undefined;
6
+ sourceCss?: string | undefined;
6
7
  cssSources?: Array<{
7
8
  file?: string | undefined;
8
9
  }> | undefined;
@@ -0,0 +1,3 @@
1
+ export declare function createTailwindV4ApplyReferenceSource(css: string, sourceOptions: {
2
+ packageName?: string;
3
+ }): string;
@@ -0,0 +1,7 @@
1
+ export declare function resolveExistingConfigPath(config: string | undefined, configRequest: string | undefined, file: string, sourceOptions: {
2
+ projectRoot?: string | undefined;
3
+ cwd?: string | undefined;
4
+ config?: string | undefined;
5
+ sourceFile?: string | undefined;
6
+ outputRoot?: string | undefined;
7
+ }): string | undefined;
@@ -0,0 +1,4 @@
1
+ import type { SourceStyleMatchOptions } from './types';
2
+ export declare function normalizeCssSourceForCompare(css: string): string;
3
+ export declare function getOutputFileStem(file: string): string;
4
+ export declare function scoreTailwindV4CssSourceFileMatch(file: string, cssSourceFile: string, sourceOptions: SourceStyleMatchOptions): number;
@@ -0,0 +1,15 @@
1
+ import type { SourceSideCssEntrySource } from '../source-files';
2
+ import type { TailwindResolvedSource } from '../../../../generator';
3
+ import type { TailwindSourceEntry } from '../../../../tailwindcss/source-scan';
4
+ export interface GeneratorSourceMetadata {
5
+ isolateCssSource?: boolean | undefined;
6
+ matchedCssSourceFile?: string | undefined;
7
+ sourceEntries?: TailwindSourceEntry[] | undefined;
8
+ sourceBase?: string | undefined;
9
+ sourceCss?: string | undefined;
10
+ }
11
+ export type GeneratorResolvedSource = TailwindResolvedSource & {
12
+ __weappTailwindcssMeta?: GeneratorSourceMetadata | undefined;
13
+ };
14
+ export declare function withGeneratorSourceMetadata(source: TailwindResolvedSource, metadata: GeneratorSourceMetadata): GeneratorResolvedSource;
15
+ export declare function withMatchedSourceSideMetadata(source: TailwindResolvedSource, resolvedEntrySource: SourceSideCssEntrySource): import("@/generator").TailwindV3ResolvedSource | import("tailwindcss-patch").TailwindV4ResolvedSource;
@@ -0,0 +1,12 @@
1
+ import type { IStyleHandlerOptions } from '@weapp-tailwindcss/postcss/types';
2
+ import type { TailwindV4CssSource } from './types';
3
+ export declare function resolvePostcssFromOption(cssHandlerOptions: IStyleHandlerOptions): string | undefined;
4
+ export declare function resolvePostcssSourceFile(cssHandlerOptions: IStyleHandlerOptions): string | undefined;
5
+ export declare function resolveCssHandlerSourceOptions(cssHandlerOptions: IStyleHandlerOptions): {
6
+ outputRoot?: string | undefined;
7
+ sourceFile?: string | undefined;
8
+ sourceCss?: string | undefined;
9
+ cssSources?: TailwindV4CssSource[] | undefined;
10
+ cssEntries?: string[] | undefined;
11
+ } | undefined;
12
+ export declare function resolveCssSourceBase(file: string, cssHandlerOptions: IStyleHandlerOptions): string;
@@ -0,0 +1,22 @@
1
+ import type { SourceSideCssEntryOptions } from '../source-files';
2
+ import type { resolveTailwindV4SourceOptionsFromPatcher } from '../../../../generator';
3
+ import type { TailwindSourceEntry } from '../../../../tailwindcss/source-scan';
4
+ import type { InternalUserDefinedOptions } from '../../../../types';
5
+ export interface GeneratorSourceRuntimeState {
6
+ twPatcher: InternalUserDefinedOptions['twPatcher'];
7
+ }
8
+ export interface GeneratorSourceSelectionOptions {
9
+ runtime?: Set<string> | undefined;
10
+ getSourceCandidatesForEntries?: ((entries: TailwindSourceEntry[] | undefined) => Set<string>) | undefined;
11
+ cssEntries?: string[] | undefined;
12
+ cssSources?: TailwindV4CssSource[] | undefined;
13
+ }
14
+ export type TailwindV4SourceOptions = ReturnType<typeof resolveTailwindV4SourceOptionsFromPatcher> & {
15
+ config?: string | undefined;
16
+ outputRoot?: string | undefined;
17
+ sourceFile?: string | undefined;
18
+ };
19
+ export type TailwindV4CssSource = NonNullable<TailwindV4SourceOptions['cssSources']>[number];
20
+ export type TailwindV4CssSourceRef = Pick<TailwindV4CssSource, 'file'>;
21
+ export interface SourceStyleMatchOptions extends SourceSideCssEntryOptions {
22
+ }
@@ -1,26 +1,9 @@
1
1
  import type { IStyleHandlerOptions } from '@weapp-tailwindcss/postcss/types';
2
+ import type { GeneratorSourceRuntimeState, GeneratorSourceSelectionOptions } from './source-resolver/types';
2
3
  import type { NormalizedWeappTailwindcssGeneratorOptions, TailwindResolvedSource } from '../../../generator';
3
- import type { TailwindSourceEntry } from '../../../tailwindcss/source-scan';
4
- import type { InternalUserDefinedOptions } from '../../../types';
5
- interface GeneratorSourceRuntimeState {
6
- twPatcher: InternalUserDefinedOptions['twPatcher'];
7
- }
8
- interface GeneratorSourceSelectionOptions {
9
- runtime?: Set<string> | undefined;
10
- getSourceCandidatesForEntries?: ((entries: TailwindSourceEntry[] | undefined) => Set<string>) | undefined;
11
- cssEntries?: string[] | undefined;
12
- }
13
- export interface GeneratorSourceMetadata {
14
- matchedCssSourceFile?: string | undefined;
15
- sourceEntries?: TailwindSourceEntry[] | undefined;
16
- sourceBase?: string | undefined;
17
- sourceCss?: string | undefined;
18
- }
19
- export type GeneratorResolvedSource = TailwindResolvedSource & {
20
- __weappTailwindcssMeta?: GeneratorSourceMetadata | undefined;
21
- };
22
- export declare function resolveCssSourceBase(file: string, cssHandlerOptions: IStyleHandlerOptions): string;
4
+ export type { GeneratorResolvedSource, GeneratorSourceMetadata } from './source-resolver/metadata';
5
+ export { resolveCssSourceBase } from './source-resolver/postcss-source';
6
+ export type { GeneratorSourceRuntimeState, GeneratorSourceSelectionOptions } from './source-resolver/types';
23
7
  export declare function resolveGeneratorSource(majorVersion: number | undefined, runtimeState: GeneratorSourceRuntimeState, rawSource: string, file: string, cssHandlerOptions: IStyleHandlerOptions, generatorOptions?: NormalizedWeappTailwindcssGeneratorOptions, selectionOptions?: GeneratorSourceSelectionOptions): Promise<import("@/generator").TailwindV3ResolvedSource | import("tailwindcss-patch").TailwindV4ResolvedSource | undefined>;
24
8
  export declare function resolveGeneratorSources(majorVersion: number | undefined, runtimeState: GeneratorSourceRuntimeState, rawSource: string, file: string, cssHandlerOptions: IStyleHandlerOptions, generatorOptions?: NormalizedWeappTailwindcssGeneratorOptions, selectionOptions?: GeneratorSourceSelectionOptions): Promise<TailwindResolvedSource[]>;
25
- export declare function resolveGeneratorSourceEntries(source: TailwindResolvedSource, runtimeState?: GeneratorSourceRuntimeState): Promise<TailwindSourceEntry[] | undefined>;
26
- export {};
9
+ export declare function resolveGeneratorSourceEntries(source: TailwindResolvedSource, runtimeState?: GeneratorSourceRuntimeState): Promise<any>;
@@ -1,4 +1,5 @@
1
1
  import type { IStyleHandlerOptions } from '@weapp-tailwindcss/postcss/types';
2
+ import type { TailwindV4CssSource } from './source-resolver/types';
2
3
  import type { TailwindSourceEntry } from '../../../tailwindcss/source-scan';
3
4
  import type { InternalUserDefinedOptions } from '../../../types';
4
5
  export interface GenerateCssByGeneratorOptions {
@@ -12,6 +13,7 @@ export interface GenerateCssByGeneratorOptions {
12
13
  file: string;
13
14
  cssHandlerOptions: IStyleHandlerOptions;
14
15
  cssUserHandlerOptions: IStyleHandlerOptions;
16
+ cssSources?: TailwindV4CssSource[] | undefined;
15
17
  getSourceCandidatesForEntries?: ((entries: TailwindSourceEntry[] | undefined) => Set<string>) | undefined;
16
18
  styleHandler: InternalUserDefinedOptions['styleHandler'];
17
19
  debug: (format: string, ...args: unknown[]) => void;
@@ -1,5 +1,6 @@
1
1
  import type { GenerateCssByGeneratorOptions } from './types';
2
2
  export interface ValidateCandidatesByGeneratorOptions extends Omit<GenerateCssByGeneratorOptions, 'runtime'> {
3
3
  candidates: Set<string>;
4
+ skipGenerateFallback?: boolean | undefined;
4
5
  }
5
6
  export declare function validateCandidatesByGenerator(options: ValidateCandidatesByGeneratorOptions): Promise<Set<string>>;
@@ -3,6 +3,7 @@ export interface HmrTimingDetails {
3
3
  file?: string;
4
4
  hooks?: Record<string, HmrTimingHookSummary>;
5
5
  metric?: 'hook' | 'total';
6
+ memoryDebug?: Record<string, unknown> | undefined;
6
7
  wallMs?: number;
7
8
  }
8
9
  export interface HmrTimingHookSummary {
@@ -0,0 +1,27 @@
1
+ import type { RememberedCssSource } from './generate-bundle';
2
+ export declare function normalizeCssSourceIdentity(sourceFile: string): string;
3
+ export declare function shouldCollectTransformedSourceCandidates(id: string): boolean;
4
+ export declare function createViteCssMemory(options: {
5
+ debug: (format: string, ...args: unknown[]) => void;
6
+ getSourceCandidateSource: (file: string) => string | undefined;
7
+ }): {
8
+ getKnownSfcSource: (file: string) => string | undefined;
9
+ getRememberedCssSignature: (file: string) => string | undefined;
10
+ getRememberedCssSourceEntry: (file: string) => RememberedCssSource | undefined;
11
+ getRememberedCssSources: () => Map<string, RememberedCssSource>;
12
+ getStats: () => {
13
+ rememberedCssSources: number;
14
+ rememberedCssSignatureByFile: number;
15
+ knownSfcSources: number;
16
+ };
17
+ rememberCssSource: (entry: RememberedCssSource, cssRuntimeSignature?: string) => void;
18
+ rememberKnownSfcSource: (id: string, code: string) => void;
19
+ refreshRememberedCssSource: (remembered: RememberedCssSource) => Promise<RememberedCssSource | undefined>;
20
+ refreshRememberedCssSourceByCurrentFile: (sourceFile: string) => Promise<void>;
21
+ refreshRememberedCssSourceBySourceFile: (sourceFile: string, rawSource: string) => void;
22
+ setRememberedCssSignature: (file: string, cssRuntimeSignature: string) => void;
23
+ prune: (pruneOptions: {
24
+ activeFiles: Set<string>;
25
+ activeKnownSfcFiles?: Set<string> | undefined;
26
+ }) => void;
27
+ };
@@ -0,0 +1,2 @@
1
+ import type { OutputAsset, OutputChunk } from 'rollup';
2
+ export declare function normalizeBundleFileNameKeysForTest(bundle: Record<string, OutputAsset | OutputChunk>): void;
@@ -0,0 +1,8 @@
1
+ import type { TailwindV4CssSource } from 'tailwindcss-patch';
2
+ import type { InternalUserDefinedOptions } from '../../../types';
3
+ export interface ConfiguredCssSourceEntry {
4
+ file: string;
5
+ source: string;
6
+ }
7
+ export declare function collectConfiguredTailwindV4CssSources(opts: InternalUserDefinedOptions): TailwindV4CssSource[];
8
+ export declare function collectConfiguredTailwindV4CssSourceEntries(opts: InternalUserDefinedOptions, fallbackBase: string): ConfiguredCssSourceEntry[];
@@ -0,0 +1,4 @@
1
+ import type { OutputAsset } from 'rollup';
2
+ import type { GenerateBundleThis } from './types';
3
+ export declare function createCssAssetEmitter(context: Pick<GenerateBundleThis, 'emitFile'>): (fileName: string, source: string) => OutputAsset;
4
+ export declare function resolveAssetSourceFile(asset: OutputAsset, fallbackFile: string): string;
@@ -21,5 +21,10 @@ export interface CssHandlerOptionsCache {
21
21
  getCssHandlerOptions: (file: string) => CssHandlerOptions;
22
22
  getCssUserHandlerOptions: (file: string) => CssHandlerOptions;
23
23
  }
24
+ export declare function resolveViteCssHandlerExtraOptions(file: string): {
25
+ isMainChunk: boolean;
26
+ } | {
27
+ isMainChunk?: never;
28
+ };
24
29
  export declare function createCssHandlerOptionsCache(options: CssHandlerOptionsCacheOptions): CssHandlerOptionsCache;
25
30
  export {};
@@ -1,14 +1,16 @@
1
1
  import type { InternalUserDefinedOptions } from '../../../types';
2
2
  export declare const SOURCE_STYLE_OUTPUT_EXT_RE: RegExp;
3
3
  export declare const CSS_SOURCE_OUTPUT_EXT_RE: RegExp;
4
- export declare const MINI_PROGRAM_STYLE_OUTPUT_EXT_RE: RegExp;
4
+ export declare function resolveMiniProgramStyleOutputExtension(options?: {
5
+ cssMatcher?: ((file: string) => boolean) | undefined;
6
+ fallback?: string | undefined;
7
+ files?: Iterable<string> | undefined;
8
+ stem?: string | undefined;
9
+ }): string;
5
10
  export declare function resolveReplayCssOutputFile(rootDir: string, file: string): string;
6
- export declare function resolveViteCssOutputFile(file: string, opts: InternalUserDefinedOptions, isWebGeneratorTarget: boolean, preserveCssExtension?: boolean): string;
7
- export declare function resolveViteCssPipelineOutputFile(file: string, _opts: Pick<InternalUserDefinedOptions, 'cssMatcher'>, rootDir: string, isWebGeneratorTarget?: boolean, preserveCssExtension?: boolean): string;
11
+ export declare function resolveReplayCssOutputFileFromSourceRoot(rootDir: string, file: string, sourceRoot: string | undefined): string;
12
+ export declare function resolveViteCssOutputFile(file: string, opts: InternalUserDefinedOptions, isWebGeneratorTarget: boolean, preserveCssExtension?: boolean, styleOutputExtension?: string | undefined, styleOutputFiles?: Iterable<string> | undefined): string;
13
+ export declare function resolveViteCssPipelineOutputFile(file: string, opts: Pick<InternalUserDefinedOptions, 'cssMatcher' | 'platform'>, rootDir: string, isWebGeneratorTarget?: boolean, preserveCssExtension?: boolean, sourceRoot?: string | undefined, styleOutputExtension?: string | undefined, styleOutputFiles?: Iterable<string> | undefined): string;
8
14
  export declare function canProcessViteSourceStyleAsCss(source: string, file: string): boolean;
9
15
  export declare function normalizeCssSourceForCompare(css: string): string;
10
16
  export declare function stripStyleFileExtension(file: string): string;
11
- export declare function isAppOriginCssFile(file: string): boolean;
12
- export declare function isMainAppCssFile(file: string): boolean;
13
- export declare function isMainStyleEntryCssFile(file: string): boolean;
14
- export declare function isTailwindEntryCssFile(file: string): boolean;
@@ -0,0 +1,7 @@
1
+ export declare function resolveGenerateBundleEnvFlags(): {
2
+ forceRuntimeRefreshByEnv: boolean;
3
+ disableDirtyOptimization: boolean;
4
+ disableJsPrecheck: boolean;
5
+ debugCssDiff: boolean;
6
+ disableV3OxideSourceRuntime: boolean;
7
+ };
@@ -0,0 +1,58 @@
1
+ import type { OutputAsset, OutputChunk } from 'rollup';
2
+ import type { BundleBuildState, BundleSnapshot } from '../bundle-state';
3
+ import type { BundleMetrics } from './metrics';
4
+ import type { GenerateBundleContext } from './types';
5
+ interface FinalizeGenerateBundleOptions {
6
+ activeProcessCacheKeys: Set<string>;
7
+ activeProcessHashKeys: Set<string | number>;
8
+ activeViteCssCacheFiles: Set<string>;
9
+ bundle: Record<string, OutputAsset | OutputChunk>;
10
+ bundleFiles: string[];
11
+ cache: GenerateBundleContext['opts']['cache'];
12
+ cssTaskFactories: Array<() => Promise<void>>;
13
+ debug: GenerateBundleContext['debug'];
14
+ defaultStyleOutputExtension: string;
15
+ formatIteration: number;
16
+ generatorCandidateSignature: string;
17
+ generatorRuntime: Set<string>;
18
+ getCssHandlerOptions: (file: string) => ReturnType<ReturnType<typeof import('./css-handler-options').createCssHandlerOptionsCache>['getCssHandlerOptions']>;
19
+ getSourceCandidateSourcesForEntries: GenerateBundleContext['getSourceCandidateSourcesForEntries'];
20
+ getSourceCandidatesForEntries: GenerateBundleContext['getSourceCandidatesForEntries'];
21
+ getViteCssCacheStats: GenerateBundleContext['getViteCssCacheStats'];
22
+ getViteProcessedCssAssetResults: GenerateBundleContext['getViteProcessedCssAssetResults'];
23
+ hmrTimingRecorder: GenerateBundleContext['hmrTimingRecorder'];
24
+ hmrTimingStartedAt: number;
25
+ isHarmonyAppStyleTarget: boolean;
26
+ isNativeAppStyleTarget: boolean;
27
+ isViteProcessedCssAsset: GenerateBundleContext['isViteProcessedCssAsset'];
28
+ isWebGeneratorTarget: boolean;
29
+ lastCssResultByFile: Map<string, string>;
30
+ lastCssSourceHashByFile: Map<string, string>;
31
+ linkedByEntry: Map<string, Set<string>> | undefined;
32
+ markCssAssetProcessed: GenerateBundleContext['markCssAssetProcessed'];
33
+ metrics: BundleMetrics;
34
+ onEnd: GenerateBundleContext['opts']['onEnd'];
35
+ onUpdate: GenerateBundleContext['opts']['onUpdate'];
36
+ opts: GenerateBundleContext['opts'];
37
+ outDir: string;
38
+ pendingLinkedUpdates: Array<() => void>;
39
+ pruneViteCssCaches: GenerateBundleContext['pruneViteCssCaches'];
40
+ recordCssAssetResult: GenerateBundleContext['recordCssAssetResult'];
41
+ recordTimingDetail: (name: string, startedAt: number) => void;
42
+ recordViteProcessedCssAssetResult: GenerateBundleContext['recordViteProcessedCssAssetResult'];
43
+ rootDir: string;
44
+ runtime: Set<string>;
45
+ runtimeState: GenerateBundleContext['runtimeState'];
46
+ shouldPreserveAppCssExtension: boolean;
47
+ snapshot: BundleSnapshot;
48
+ sourceCandidates: Set<string>;
49
+ sourceRoot: string | undefined;
50
+ state: BundleBuildState;
51
+ styleHandler: GenerateBundleContext['opts']['styleHandler'];
52
+ tasks: Promise<void>[];
53
+ timingDetails: Record<string, number>;
54
+ transformRuntime: Set<string>;
55
+ useIncrementalMode: boolean;
56
+ }
57
+ export declare function finalizeGenerateBundle(options: FinalizeGenerateBundleOptions): Promise<void>;
58
+ export {};
@@ -0,0 +1,31 @@
1
+ import type { OutputAsset, OutputChunk } from 'rollup';
2
+ import type { BundleSnapshot, BundleStateEntry } from '../bundle-state';
3
+ import type { BundleMetrics } from './metrics';
4
+ import type { GenerateBundleContext } from './types';
5
+ import type { CreateJsHandlerOptions, LinkedJsModuleResult } from '../../../types';
6
+ interface ProcessJsBundleEntryOptions {
7
+ applyLinkedUpdates: (linked?: Record<string, LinkedJsModuleResult>) => void;
8
+ bundle: Record<string, OutputAsset | OutputChunk>;
9
+ cache: GenerateBundleContext['opts']['cache'];
10
+ createHandlerOptions: (absoluteFilename: string, extra?: CreateJsHandlerOptions) => CreateJsHandlerOptions;
11
+ debug: GenerateBundleContext['debug'];
12
+ disableJsPrecheck: boolean;
13
+ entry: BundleStateEntry;
14
+ getJsEntry: ReturnType<typeof import('./js-entries').createJsEntryResolver>;
15
+ jsHandler: GenerateBundleContext['opts']['jsHandler'];
16
+ jsTaskFactories: Array<() => Promise<void>>;
17
+ linkedByEntry: Map<string, Set<string>> | undefined;
18
+ metrics: BundleMetrics;
19
+ onUpdate: GenerateBundleContext['opts']['onUpdate'];
20
+ outDir: string;
21
+ processFiles: BundleSnapshot['processFiles'];
22
+ rememberProcessCacheKey: (cacheKey: string, hashKey?: string | number) => void;
23
+ runtimeSignature: string;
24
+ snapshot: BundleSnapshot;
25
+ timeTask: (name: string, task: () => Promise<void>) => Promise<void>;
26
+ transformRuntime: Set<string>;
27
+ uniAppX: GenerateBundleContext['opts']['uniAppX'];
28
+ useIncrementalMode: boolean;
29
+ }
30
+ export declare function processJsBundleEntry(options: ProcessJsBundleEntryOptions): void;
31
+ export {};
@@ -0,0 +1,77 @@
1
+ import type { GenerateBundleContext } from './types';
2
+ export declare function resolveViteMemoryDebugStats(context: {
3
+ activeProcessCacheKeys: Set<string>;
4
+ activeProcessHashKeys: Set<string | number>;
5
+ cache: GenerateBundleContext['opts']['cache'];
6
+ generatorRuntimeSize: number;
7
+ getViteCssCacheStats?: (() => Record<string, unknown>) | undefined;
8
+ lastCssResultByFile: Map<string, string>;
9
+ phase: string;
10
+ runtimeSize: number;
11
+ sourceCandidatesSize: number;
12
+ transformRuntimeSize: number;
13
+ useIncrementalMode: boolean;
14
+ }): {
15
+ phase: string;
16
+ mode: string;
17
+ process: {
18
+ rssMb: number;
19
+ heapTotalMb: number;
20
+ heapUsedMb: number;
21
+ externalMb: number;
22
+ arrayBuffersMb: number;
23
+ };
24
+ runtime: {
25
+ sourceCandidates: number;
26
+ runtime: number;
27
+ transformRuntime: number;
28
+ generatorRuntime: number;
29
+ };
30
+ processCache: {
31
+ instance: number;
32
+ hashMap: number;
33
+ activeCacheKeys: number;
34
+ activeHashKeys: number;
35
+ };
36
+ viteCss: {
37
+ lastCssResultByFile: {
38
+ bytes: number;
39
+ mb: number;
40
+ size: number;
41
+ };
42
+ };
43
+ tailwind: {
44
+ v3: {
45
+ max: number;
46
+ entryCandidatesMax: number;
47
+ entryCssBytesMax: number;
48
+ size: number;
49
+ entries: {
50
+ key: string;
51
+ candidates: number;
52
+ classSet: number;
53
+ cssBytes: number;
54
+ rawCssBytes: number;
55
+ exactResults: number;
56
+ }[];
57
+ keys: string[];
58
+ };
59
+ v4: {
60
+ max: number;
61
+ entryCandidatesMax: number;
62
+ entryCssBytesMax: number;
63
+ size: number;
64
+ taskMax: number;
65
+ taskSize: number;
66
+ entries: {
67
+ key: string;
68
+ candidates: number;
69
+ classSet: number;
70
+ cssBytes: number;
71
+ rawCssBytes: number;
72
+ }[];
73
+ keys: string[];
74
+ taskKeys: string[];
75
+ };
76
+ };
77
+ } | undefined;
@@ -0,0 +1,53 @@
1
+ import type { OutputAsset, OutputChunk } from 'rollup';
2
+ import type { BundleMetrics } from './metrics';
3
+ import type { GenerateBundleContext, RememberedCssSource } from './types';
4
+ interface ProcessRememberedCssReplayOptions {
5
+ addWatchFile: (id: string) => void;
6
+ bundle: Record<string, OutputAsset | OutputChunk>;
7
+ bundleFiles: string[];
8
+ cache: GenerateBundleContext['opts']['cache'];
9
+ createScopedGeneratorRuntime: (outputFile: string, cssHandlerOptions: {
10
+ isMainChunk?: boolean | undefined;
11
+ }, runtime: Set<string>, rawSource?: string | undefined, sourceFile?: string | undefined) => Promise<Set<string>>;
12
+ createScopedSourceCandidateGetter: (outputFile: string, cssHandlerOptions: {
13
+ isMainChunk?: boolean | undefined;
14
+ }) => GenerateBundleContext['getSourceCandidatesForEntries'];
15
+ createScopedSourceCandidateSourceGetter: (outputFile: string, cssHandlerOptions: {
16
+ isMainChunk?: boolean | undefined;
17
+ }) => GenerateBundleContext['getSourceCandidateSourcesForEntries'];
18
+ cssTaskFactories: Array<() => Promise<void>>;
19
+ debug: GenerateBundleContext['debug'];
20
+ defaultStyleOutputExtension: string;
21
+ emitOrReplayCssAsset: (fileName: string, source: string) => OutputAsset;
22
+ generatorRuntime: Set<string>;
23
+ getCssHandlerOptions: (file: string) => ReturnType<ReturnType<typeof import('./css-handler-options').createCssHandlerOptionsCache>['getCssHandlerOptions']>;
24
+ getCssUserHandlerOptions: (file: string) => ReturnType<ReturnType<typeof import('./css-handler-options').createCssHandlerOptionsCache>['getCssUserHandlerOptions']>;
25
+ getRememberedCssSignature?: ((file: string) => string | undefined) | undefined;
26
+ getRememberedCssSources?: (() => Iterable<[string, RememberedCssSource]>) | undefined;
27
+ isNativeAppStyleTarget: boolean;
28
+ isWebGeneratorTarget: boolean;
29
+ lastCssResultByFile: Map<string, string>;
30
+ lastCssSourceHashByFile: Map<string, string>;
31
+ markCssAssetProcessed: GenerateBundleContext['markCssAssetProcessed'];
32
+ metrics: BundleMetrics;
33
+ normalizeViteCssCacheKey: (file: string) => string;
34
+ onUpdate: GenerateBundleContext['opts']['onUpdate'];
35
+ opts: GenerateBundleContext['opts'];
36
+ recordCssAssetResult: GenerateBundleContext['recordCssAssetResult'];
37
+ recordViteProcessedCssAssetResult: GenerateBundleContext['recordViteProcessedCssAssetResult'];
38
+ refreshRememberedCssSource?: GenerateBundleContext['refreshRememberedCssSource'];
39
+ rootDir: string;
40
+ runtimeState: GenerateBundleContext['runtimeState'];
41
+ setRememberedCssSignature?: ((file: string, cssRuntimeSignature: string) => void) | undefined;
42
+ shouldInjectCssIntoMainFromOutput: (outputFile: string, sourceFile: string, cssHandlerOptions: {
43
+ isMainChunk?: boolean | undefined;
44
+ }) => boolean;
45
+ shouldPreserveAppCssExtension: boolean;
46
+ sourceRoot: string | undefined;
47
+ styleHandler: GenerateBundleContext['opts']['styleHandler'];
48
+ timeTask: (name: string, task: () => Promise<void>) => Promise<void>;
49
+ useIncrementalMode: boolean;
50
+ activeViteCssCacheFiles: Set<string>;
51
+ }
52
+ export declare function processRememberedCssReplay(options: ProcessRememberedCssReplayOptions): Promise<void>;
53
+ export {};
@@ -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): Map<string, {
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, {
9
9
  key: string;
10
10
  remembered: RememberedCssSource;
11
11
  }[]>;