weapp-tailwindcss 5.0.0-next.10 → 5.0.0-next.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 (110) hide show
  1. package/dist/{bundle-state-EUbcdKqo.js → bundle-state-Bz8vLnCf.js} +42 -3
  2. package/dist/{bundle-state-BWqi5ZyX.mjs → bundle-state-CP2XS3Uj.mjs} +31 -4
  3. package/dist/bundlers/shared/cache.d.ts +6 -6
  4. package/dist/bundlers/shared/css-cleanup.d.ts +6 -1
  5. package/dist/bundlers/shared/css-imports.d.ts +3 -3
  6. package/dist/bundlers/shared/generator-css/directives.d.ts +10 -3
  7. package/dist/bundlers/shared/generator-css/source-files.d.ts +9 -6
  8. package/dist/bundlers/shared/generator-css/source-resolver.d.ts +16 -2
  9. package/dist/bundlers/shared/generator-css.d.ts +5 -1
  10. package/dist/bundlers/shared/hmr-timing.d.ts +22 -0
  11. package/dist/bundlers/shared/style-requests.d.ts +2 -0
  12. package/dist/bundlers/vite/bundle-state.d.ts +1 -0
  13. package/dist/bundlers/vite/css-finalizer.d.ts +2 -0
  14. package/dist/bundlers/vite/generate-bundle/css-handler-options.d.ts +5 -1
  15. package/dist/bundlers/vite/generate-bundle/css-share-scope.d.ts +1 -0
  16. package/dist/bundlers/vite/generate-bundle.d.ts +8 -1
  17. package/dist/bundlers/vite/incremental-runtime-class-set.d.ts +5 -1
  18. package/dist/bundlers/vite/rewrite-css-imports.d.ts +5 -5
  19. package/dist/bundlers/vite/runtime-class-set.d.ts +4 -1
  20. package/dist/bundlers/vite/source-candidates.d.ts +13 -2
  21. package/dist/bundlers/vite/source-scan.d.ts +21 -3
  22. package/dist/bundlers/vite/static-config-content.d.ts +5 -0
  23. package/dist/bundlers/webpack/BaseUnifiedPlugin/shared.d.ts +5 -0
  24. package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets.d.ts +3 -3
  25. package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-loaders.d.ts +3 -3
  26. package/dist/cache/index.d.ts +6 -6
  27. package/dist/cli/context.d.ts +1 -11
  28. package/dist/cli/doctor/types.d.ts +11 -11
  29. package/dist/cli/vscode-entry.d.ts +3 -3
  30. package/dist/cli.js +468 -10
  31. package/dist/cli.mjs +466 -9
  32. package/dist/context/tailwindcss.d.ts +1 -1
  33. package/dist/core.js +1 -1
  34. package/dist/core.mjs +1 -1
  35. package/dist/css-macro/postcss.js +3 -2
  36. package/dist/css-macro/postcss.mjs +3 -2
  37. package/dist/css-macro.js +2 -2
  38. package/dist/css-macro.mjs +2 -2
  39. package/dist/defaults.js +1 -1
  40. package/dist/defaults.mjs +1 -1
  41. package/dist/escape.js +10 -2
  42. package/dist/escape.mjs +10 -2
  43. package/dist/generator/options.d.ts +8 -6
  44. package/dist/generator/types.d.ts +3 -3
  45. package/dist/generator-C9H44wEF.mjs +32 -0
  46. package/dist/generator-CRORPkpW.js +55 -0
  47. package/dist/generator.js +12 -11
  48. package/dist/generator.mjs +2 -1
  49. package/dist/gulp.js +57 -18
  50. package/dist/gulp.mjs +54 -15
  51. package/dist/{incremental-runtime-class-set-BYmzQ-_f.js → incremental-runtime-class-set-DN9KKjSi.js} +753 -155
  52. package/dist/{incremental-runtime-class-set-BgMW6wf2.mjs → incremental-runtime-class-set-Dbn4yPfZ.mjs} +724 -144
  53. package/dist/index.js +4 -4
  54. package/dist/index.mjs +4 -4
  55. package/dist/js/precheck.d.ts +2 -2
  56. package/dist/lightningcss/style-handler/selector-transform.d.ts +1 -1
  57. package/dist/lightningcss/style-handler.d.ts +3 -3
  58. package/dist/{postcss-Dg-_lyHS.js → postcss-Ab7YzAbs.js} +37 -23
  59. package/dist/postcss-CZE8k8oP.js +5483 -0
  60. package/dist/{postcss-C7efq3hr.mjs → postcss-CtlrNknb.mjs} +26 -12
  61. package/dist/postcss.js +1 -1
  62. package/dist/postcss.mjs +1 -1
  63. package/dist/{precheck-B32p-gLI.js → precheck-CRX-pMKJ.js} +63 -37
  64. package/dist/{precheck-B4RH6ZNN.mjs → precheck-SG48aLG2.mjs} +56 -30
  65. package/dist/presets.js +11 -11
  66. package/dist/presets.mjs +11 -11
  67. package/dist/shared/mpx.d.ts +1 -0
  68. package/dist/source-candidates-C4YgmZ8A.js +274 -0
  69. package/dist/source-candidates-CyupdLKi.mjs +259 -0
  70. package/dist/tailwindcss/runtime/cache.d.ts +4 -3
  71. package/dist/tailwindcss/runtime.d.ts +9 -9
  72. package/dist/tailwindcss/v3-engine/types.d.ts +17 -14
  73. package/dist/tailwindcss/v4/css-entries.d.ts +2 -2
  74. package/dist/tailwindcss/v4/patcher.d.ts +1 -1
  75. package/dist/tailwindcss/v4-engine/types.d.ts +14 -5
  76. package/dist/{tailwindcss-C5IgPlQ0.mjs → tailwindcss-BbTVeQkG.mjs} +52 -33
  77. package/dist/{tailwindcss-Bu-RWIHx.js → tailwindcss-DZ6jVYb4.js} +59 -40
  78. package/dist/types/index.d.ts +44 -40
  79. package/dist/types/user-defined-options/general.d.ts +21 -21
  80. package/dist/types/user-defined-options/important.d.ts +30 -27
  81. package/dist/types/user-defined-options/lifecycle.d.ts +4 -4
  82. package/dist/types/user-defined-options/matcher.d.ts +6 -6
  83. package/dist/utils/object.d.ts +9 -0
  84. package/dist/{utils-Btw1iOVV.mjs → utils-CycMvPn_.mjs} +1 -1
  85. package/dist/{utils-BiShvil9.js → utils-D0MZP_tr.js} +1 -1
  86. package/dist/v3-engine-D61eilBl.mjs +3208 -0
  87. package/dist/v3-engine-DwV1E6rX.js +3461 -0
  88. package/dist/{vite-BU74SkOi.mjs → vite-Ti_qSctn.mjs} +434 -536
  89. package/dist/{vite-CKjx_5c3.js → vite-xKS6RvLR.js} +437 -542
  90. package/dist/vite.js +1 -1
  91. package/dist/vite.mjs +1 -1
  92. package/dist/weapp-tw-css-import-rewrite-loader.js +143 -18
  93. package/dist/weapp-tw-runtime-classset-loader.js +44 -6
  94. package/dist/{webpack-CAk_ITq7.mjs → webpack-DvptFz7B.mjs} +111 -39
  95. package/dist/{webpack-damWiYqY.js → webpack-wfNutjMm.js} +115 -43
  96. package/dist/webpack.js +1 -1
  97. package/dist/webpack.mjs +1 -1
  98. package/package.json +5 -5
  99. package/dist/cache-BVAiJV3J.js +0 -502
  100. package/dist/cache-CHs4DXui.mjs +0 -434
  101. package/dist/generator-DKkhJbOg.js +0 -1531
  102. package/dist/generator-UBmfduYg.mjs +0 -1432
  103. package/dist/runtime-patch-CwN5ya72.mjs +0 -71
  104. package/dist/runtime-patch-D6mBo_KB.js +0 -85
  105. package/dist/source-scan-BaYvNx-k.js +0 -293
  106. package/dist/source-scan-cGZxoJqP.mjs +0 -254
  107. /package/dist/{constants-BeeyfJ9k.js → constants-BoB_6lFw.js} +0 -0
  108. /package/dist/{constants-BG12WAKw.mjs → constants-E_loJC49.mjs} +0 -0
  109. /package/dist/{logger-EVNB9z7i.js → logger-BRy6XPQ2.js} +0 -0
  110. /package/dist/{logger-CZUxvJJD.mjs → logger-Bub1jggA.mjs} +0 -0
@@ -1,5 +1,5 @@
1
1
  const require_chunk = require("./chunk-8l464Juk.js");
2
- const require_precheck = require("./precheck-B32p-gLI.js");
2
+ const require_precheck = require("./precheck-CRX-pMKJ.js");
3
3
  let node_module = require("node:module");
4
4
  let node_path = require("node:path");
5
5
  node_path = require_chunk.__toESM(node_path);
@@ -49,6 +49,30 @@ function resolveOutputSpecifier(specifier, importer, outDir, hasOutput) {
49
49
  return matchWithExtensions(candidate, hasOutput);
50
50
  }
51
51
  //#endregion
52
+ //#region src/bundlers/shared/style-requests.ts
53
+ const SOURCE_STYLE_EXT_RE = /\.(?:css|scss|sass|less|styl|stylus|pcss|postcss)$/i;
54
+ const STYLE_QUERY_RE = /(?:^|&)type=styles?(?:&|$)/;
55
+ const STYLE_LANG_QUERY_RE = /(?:^|&)lang(?:[.=](?:css|scss|sass|less|styl|stylus|pcss|postcss))?(?:&|$)/;
56
+ function stripHash(request) {
57
+ const hashIndex = request.indexOf("#");
58
+ return hashIndex === -1 ? request : request.slice(0, hashIndex);
59
+ }
60
+ function stripRequestQuery(request) {
61
+ const normalized = stripHash(request);
62
+ const queryIndex = normalized.indexOf("?");
63
+ return queryIndex === -1 ? normalized : normalized.slice(0, queryIndex);
64
+ }
65
+ function isSourceStyleRequest(request) {
66
+ if (typeof request !== "string" || request.length === 0) return false;
67
+ const normalized = stripHash(request);
68
+ const queryIndex = normalized.indexOf("?");
69
+ const pathname = queryIndex === -1 ? normalized : normalized.slice(0, queryIndex);
70
+ if (SOURCE_STYLE_EXT_RE.test(pathname)) return true;
71
+ if (queryIndex === -1) return false;
72
+ const query = normalized.slice(queryIndex + 1);
73
+ return STYLE_QUERY_RE.test(query) || STYLE_LANG_QUERY_RE.test(query);
74
+ }
75
+ //#endregion
52
76
  //#region src/utils/disabled.ts
53
77
  function resolvePluginDisabledState(disabled) {
54
78
  if (disabled === true) return { plugin: true };
@@ -73,7 +97,9 @@ async function runWithConcurrency(factories, limit = Math.min(4, Math.max(1, fac
73
97
  const scheduleNext = () => {
74
98
  if (cursor >= factories.length) return;
75
99
  const currentIndex = cursor++;
76
- const wrapped = Promise.resolve(factories[currentIndex]()).then((value) => {
100
+ const factory = factories[currentIndex];
101
+ if (!factory) return;
102
+ const wrapped = Promise.resolve(factory()).then((value) => {
77
103
  results[currentIndex] = value;
78
104
  }).finally(() => {
79
105
  executing.delete(wrapped);
@@ -217,7 +243,8 @@ function createBundleBuildState() {
217
243
  runtimeAffectingSignatureByFile: /* @__PURE__ */ new Map(),
218
244
  runtimeAffectingHashByFile: /* @__PURE__ */ new Map(),
219
245
  linkedByEntry: /* @__PURE__ */ new Map(),
220
- dependentsByLinkedFile: /* @__PURE__ */ new Map()
246
+ dependentsByLinkedFile: /* @__PURE__ */ new Map(),
247
+ generatorCandidateSignature: void 0
221
248
  };
222
249
  }
223
250
  function createChangedByType() {
@@ -366,6 +393,12 @@ Object.defineProperty(exports, "createBundleModuleGraphOptions", {
366
393
  return createBundleModuleGraphOptions;
367
394
  }
368
395
  });
396
+ Object.defineProperty(exports, "isSourceStyleRequest", {
397
+ enumerable: true,
398
+ get: function() {
399
+ return isSourceStyleRequest;
400
+ }
401
+ });
369
402
  Object.defineProperty(exports, "normalizeOutputPathKey", {
370
403
  enumerable: true,
371
404
  get: function() {
@@ -396,6 +429,12 @@ Object.defineProperty(exports, "resolvePluginDisabledState", {
396
429
  return resolvePluginDisabledState;
397
430
  }
398
431
  });
432
+ Object.defineProperty(exports, "stripRequestQuery", {
433
+ enumerable: true,
434
+ get: function() {
435
+ return stripRequestQuery;
436
+ }
437
+ });
399
438
  Object.defineProperty(exports, "toAbsoluteOutputPath", {
400
439
  enumerable: true,
401
440
  get: function() {
@@ -1,4 +1,4 @@
1
- import { d as traverse, u as babelParse } from "./precheck-B4RH6ZNN.mjs";
1
+ import { d as traverse, u as babelParse } from "./precheck-SG48aLG2.mjs";
2
2
  import { createRequire } from "node:module";
3
3
  import path from "node:path";
4
4
  import { Buffer } from "node:buffer";
@@ -47,6 +47,30 @@ function resolveOutputSpecifier(specifier, importer, outDir, hasOutput) {
47
47
  return matchWithExtensions(candidate, hasOutput);
48
48
  }
49
49
  //#endregion
50
+ //#region src/bundlers/shared/style-requests.ts
51
+ const SOURCE_STYLE_EXT_RE = /\.(?:css|scss|sass|less|styl|stylus|pcss|postcss)$/i;
52
+ const STYLE_QUERY_RE = /(?:^|&)type=styles?(?:&|$)/;
53
+ const STYLE_LANG_QUERY_RE = /(?:^|&)lang(?:[.=](?:css|scss|sass|less|styl|stylus|pcss|postcss))?(?:&|$)/;
54
+ function stripHash(request) {
55
+ const hashIndex = request.indexOf("#");
56
+ return hashIndex === -1 ? request : request.slice(0, hashIndex);
57
+ }
58
+ function stripRequestQuery(request) {
59
+ const normalized = stripHash(request);
60
+ const queryIndex = normalized.indexOf("?");
61
+ return queryIndex === -1 ? normalized : normalized.slice(0, queryIndex);
62
+ }
63
+ function isSourceStyleRequest(request) {
64
+ if (typeof request !== "string" || request.length === 0) return false;
65
+ const normalized = stripHash(request);
66
+ const queryIndex = normalized.indexOf("?");
67
+ const pathname = queryIndex === -1 ? normalized : normalized.slice(0, queryIndex);
68
+ if (SOURCE_STYLE_EXT_RE.test(pathname)) return true;
69
+ if (queryIndex === -1) return false;
70
+ const query = normalized.slice(queryIndex + 1);
71
+ return STYLE_QUERY_RE.test(query) || STYLE_LANG_QUERY_RE.test(query);
72
+ }
73
+ //#endregion
50
74
  //#region src/utils/disabled.ts
51
75
  function resolvePluginDisabledState(disabled) {
52
76
  if (disabled === true) return { plugin: true };
@@ -71,7 +95,9 @@ async function runWithConcurrency(factories, limit = Math.min(4, Math.max(1, fac
71
95
  const scheduleNext = () => {
72
96
  if (cursor >= factories.length) return;
73
97
  const currentIndex = cursor++;
74
- const wrapped = Promise.resolve(factories[currentIndex]()).then((value) => {
98
+ const factory = factories[currentIndex];
99
+ if (!factory) return;
100
+ const wrapped = Promise.resolve(factory()).then((value) => {
75
101
  results[currentIndex] = value;
76
102
  }).finally(() => {
77
103
  executing.delete(wrapped);
@@ -215,7 +241,8 @@ function createBundleBuildState() {
215
241
  runtimeAffectingSignatureByFile: /* @__PURE__ */ new Map(),
216
242
  runtimeAffectingHashByFile: /* @__PURE__ */ new Map(),
217
243
  linkedByEntry: /* @__PURE__ */ new Map(),
218
- dependentsByLinkedFile: /* @__PURE__ */ new Map()
244
+ dependentsByLinkedFile: /* @__PURE__ */ new Map(),
245
+ generatorCandidateSignature: void 0
219
246
  };
220
247
  }
221
248
  function createChangedByType() {
@@ -340,4 +367,4 @@ function updateBundleBuildState(state, snapshot, linkedByEntry, options = {}) {
340
367
  state.dependentsByLinkedFile = invertLinkedByEntry(state.linkedByEntry);
341
368
  }
342
369
  //#endregion
343
- export { createBundleModuleGraphOptions as a, resolvePluginDisabledState as c, toAbsoluteOutputPath as d, applyLinkedResults as i, normalizeOutputPathKey as l, createBundleBuildState as n, pushConcurrentTaskFactories as o, updateBundleBuildState as r, resolvePackageDir as s, buildBundleSnapshot as t, resolveOutputSpecifier as u };
370
+ export { createBundleModuleGraphOptions as a, resolvePluginDisabledState as c, normalizeOutputPathKey as d, resolveOutputSpecifier as f, applyLinkedResults as i, isSourceStyleRequest as l, createBundleBuildState as n, pushConcurrentTaskFactories as o, toAbsoluteOutputPath as p, updateBundleBuildState as r, resolvePackageDir as s, buildBundleSnapshot as t, stripRequestQuery as u };
@@ -2,15 +2,15 @@ import type { CacheValue, HashMapKey, ICreateCacheReturnType } from '../../cache
2
2
  export interface ProcessCachedTaskOptions<TValue extends CacheValue> {
3
3
  cache: ICreateCacheReturnType;
4
4
  cacheKey: string;
5
- hashKey?: HashMapKey;
6
- rawSource?: string;
7
- hash?: string;
8
- readCache?: () => TValue | undefined;
5
+ hashKey?: HashMapKey | undefined;
6
+ rawSource?: string | undefined;
7
+ hash?: string | undefined;
8
+ readCache?: (() => TValue | undefined) | undefined;
9
9
  applyResult: (value: TValue) => void | Promise<void>;
10
10
  transform: () => Promise<{
11
11
  result: TValue;
12
- cacheValue?: CacheValue;
12
+ cacheValue?: CacheValue | undefined;
13
13
  }>;
14
- onCacheHit?: () => void;
14
+ onCacheHit?: (() => void) | undefined;
15
15
  }
16
16
  export declare function processCachedTask<TValue extends CacheValue>({ cache, cacheKey, hashKey, rawSource, hash, readCache, applyResult, transform, onCacheHit, }: ProcessCachedTaskOptions<TValue>): Promise<void>;
@@ -1,3 +1,8 @@
1
+ import type { CssPreflightOptions } from '../../types';
1
2
  export { removeUnsupportedAtSupports, removeUnsupportedMiniProgramAtRules } from './css-cleanup/at-rules';
3
+ interface FinalizeMiniProgramCssOptions {
4
+ cssPreflight?: CssPreflightOptions | undefined;
5
+ preservePseudoContentInit?: boolean;
6
+ }
2
7
  export declare function hoistTailwindPreflightBase(css: string): string;
3
- export declare function finalizeMiniProgramCss(css: string): string;
8
+ export declare function finalizeMiniProgramCss(css: string, options?: FinalizeMiniProgramCssOptions): string;
@@ -1,8 +1,8 @@
1
1
  import type { AppType } from '../../types';
2
2
  export interface ResolveTailwindcssImportOptions {
3
- join?: (base: string, subpath: string) => string;
4
- appType?: AppType;
5
- rootImport?: string;
3
+ join?: ((base: string, subpath: string) => string) | undefined;
4
+ appType?: AppType | undefined;
5
+ rootImport?: string | undefined;
6
6
  }
7
7
  export declare function resolveTailwindcssImport(specifier: string, pkgDir: string, options?: ResolveTailwindcssImportOptions): string | null;
8
8
  export declare function rewriteTailwindcssImportsInCode(code: string, pkgDir: string, options?: ResolveTailwindcssImportOptions): string | undefined;
@@ -1,13 +1,20 @@
1
+ interface TailwindDirectiveOptions {
2
+ importFallback?: boolean | undefined;
3
+ }
1
4
  export declare function parseImportRequest(params: string): string | undefined;
2
- export declare function removeTailwindSourceDirectives(rawSource: string): string;
3
- export declare function hasTailwindSourceDirectives(rawSource: string): boolean;
4
- export declare function hasTailwindRootDirectives(rawSource: string): boolean;
5
+ export declare function normalizeTailwindSourceForGenerator(rawSource: string, options?: TailwindDirectiveOptions): string;
6
+ export declare function normalizeTailwindSourceDirectives(rawSource: string, options?: TailwindDirectiveOptions): string;
7
+ export declare function removeTailwindSourceDirectives(rawSource: string, options?: TailwindDirectiveOptions): string;
8
+ export declare function hasTailwindSourceDirectives(rawSource: string, options?: TailwindDirectiveOptions): boolean;
9
+ export declare function hasTailwindRootDirectives(rawSource: string, options?: TailwindDirectiveOptions): boolean;
5
10
  export declare function hasTailwindApplyDirective(rawSource: string): boolean;
6
11
  export declare function resolveCssEntrySource(rawSource: string, base: string, options?: {
7
12
  removeConfig?: boolean;
13
+ importFallback?: boolean;
8
14
  }): {
9
15
  css: string;
10
16
  config: string | undefined;
11
17
  configRequest: string | undefined;
12
18
  base: string;
13
19
  } | undefined;
20
+ export {};
@@ -1,11 +1,14 @@
1
+ export interface SourceSideCssEntrySource {
2
+ css: string;
3
+ config?: string | undefined;
4
+ configRequest?: string | undefined;
5
+ base: string;
6
+ file: string;
7
+ }
1
8
  export declare function resolveSourceSideCssEntrySource(file: string, sourceOptions: {
2
9
  projectRoot?: string;
3
10
  cwd?: string;
11
+ outputRoot?: string;
4
12
  }, resolveOptions?: {
5
13
  removeConfig?: boolean;
6
- }): {
7
- css: string;
8
- config: string | undefined;
9
- configRequest: string | undefined;
10
- base: string;
11
- } | undefined;
14
+ }): SourceSideCssEntrySource | undefined;
@@ -1,10 +1,24 @@
1
1
  import type { IStyleHandlerOptions } from '@weapp-tailwindcss/postcss/types';
2
2
  import type { NormalizedWeappTailwindcssGeneratorOptions, TailwindResolvedSource } from '../../../generator';
3
+ import type { TailwindSourceEntry } from '../../../tailwindcss/source-scan';
3
4
  import type { InternalUserDefinedOptions } from '../../../types';
4
5
  interface GeneratorSourceRuntimeState {
5
6
  twPatcher: InternalUserDefinedOptions['twPatcher'];
6
7
  }
8
+ interface GeneratorSourceSelectionOptions {
9
+ runtime?: Set<string> | undefined;
10
+ getSourceCandidatesForEntries?: ((entries: TailwindSourceEntry[] | undefined) => Set<string>) | undefined;
11
+ }
12
+ export interface GeneratorSourceMetadata {
13
+ matchedCssSourceFile?: string | undefined;
14
+ sourceBase?: string | undefined;
15
+ sourceCss?: string | undefined;
16
+ }
17
+ export type GeneratorResolvedSource = TailwindResolvedSource & {
18
+ __weappTailwindcssMeta?: GeneratorSourceMetadata | undefined;
19
+ };
7
20
  export declare function resolveCssSourceBase(file: string, cssHandlerOptions: IStyleHandlerOptions): string;
8
- export declare function resolveGeneratorSource(majorVersion: number | undefined, runtimeState: GeneratorSourceRuntimeState, rawSource: string, file: string, cssHandlerOptions: IStyleHandlerOptions, generatorOptions?: NormalizedWeappTailwindcssGeneratorOptions): Promise<import("@/generator").TailwindV3ResolvedSource | import("tailwindcss-patch").TailwindV4ResolvedSource>;
9
- export declare function resolveGeneratorSources(majorVersion: number | undefined, runtimeState: GeneratorSourceRuntimeState, rawSource: string, file: string, cssHandlerOptions: IStyleHandlerOptions, generatorOptions?: NormalizedWeappTailwindcssGeneratorOptions): Promise<TailwindResolvedSource[]>;
21
+ export declare function resolveGeneratorSource(majorVersion: number | undefined, runtimeState: GeneratorSourceRuntimeState, rawSource: string, file: string, cssHandlerOptions: IStyleHandlerOptions, generatorOptions?: NormalizedWeappTailwindcssGeneratorOptions, selectionOptions?: GeneratorSourceSelectionOptions): Promise<import("tailwindcss-patch").TailwindV4ResolvedSource | import("@/generator").TailwindV3ResolvedSource | undefined>;
22
+ export declare function resolveGeneratorSources(majorVersion: number | undefined, runtimeState: GeneratorSourceRuntimeState, rawSource: string, file: string, cssHandlerOptions: IStyleHandlerOptions, generatorOptions?: NormalizedWeappTailwindcssGeneratorOptions, selectionOptions?: GeneratorSourceSelectionOptions): Promise<TailwindResolvedSource[]>;
23
+ export declare function resolveGeneratorSourceEntries(source: TailwindResolvedSource, runtimeState?: GeneratorSourceRuntimeState): Promise<TailwindSourceEntry[] | undefined>;
10
24
  export {};
@@ -1,6 +1,7 @@
1
1
  import type { IStyleHandlerOptions } from '@weapp-tailwindcss/postcss/types';
2
+ import type { TailwindSourceEntry } from '../../tailwindcss/source-scan';
2
3
  import type { InternalUserDefinedOptions } from '../../types';
3
- export { hasTailwindSourceDirectives, removeTailwindSourceDirectives, resolveCssEntrySource, } from './generator-css/directives';
4
+ export { hasTailwindSourceDirectives, normalizeTailwindSourceForGenerator, removeTailwindSourceDirectives, resolveCssEntrySource, } from './generator-css/directives';
4
5
  export { removeTailwindApplyRules, } from './generator-css/legacy-compat';
5
6
  export { inheritLegacyUnitConvertedDeclarations, } from './generator-css/legacy-units';
6
7
  export { createCssAppend, hasTailwindGeneratedCss, hasTailwindGeneratedCssMarkers, removeTailwindGeneratedCssByBanner, splitTailwindV4GeneratedCss, stripGeneratorPlaceholderMarkers, stripTailwindBanner, stripTailwindBanners, } from './generator-css/markers';
@@ -16,14 +17,17 @@ export interface GenerateCssByGeneratorOptions {
16
17
  file: string;
17
18
  cssHandlerOptions: IStyleHandlerOptions;
18
19
  cssUserHandlerOptions: IStyleHandlerOptions;
20
+ getSourceCandidatesForEntries?: ((entries: TailwindSourceEntry[] | undefined) => Set<string>) | undefined;
19
21
  styleHandler: InternalUserDefinedOptions['styleHandler'];
20
22
  debug: (format: string, ...args: unknown[]) => void;
23
+ previousCss?: string | undefined;
21
24
  }
22
25
  export interface GenerateCssByGeneratorResult {
23
26
  css: string;
24
27
  target: string;
25
28
  source: 'generator';
26
29
  dependencies: string[];
30
+ incremental?: boolean | undefined;
27
31
  }
28
32
  export declare function isPureLocalCssImportWrapper(css: string): boolean;
29
33
  export declare function generateCssByGenerator(options: GenerateCssByGeneratorOptions): Promise<GenerateCssByGeneratorResult | undefined>;
@@ -0,0 +1,22 @@
1
+ export interface HmrTimingDetails {
2
+ emit?: boolean;
3
+ file?: string;
4
+ hooks?: Record<string, HmrTimingHookSummary>;
5
+ metric?: 'hook' | 'total';
6
+ wallMs?: number;
7
+ }
8
+ export interface HmrTimingHookSummary {
9
+ count: number;
10
+ durationMs: number;
11
+ maxMs: number;
12
+ }
13
+ type HmrTimingBundler = 'vite' | 'webpack' | 'gulp';
14
+ export interface HmrTimingRecorder {
15
+ emitTotal: (phase?: string) => void;
16
+ measure: <T>(phase: string, task: () => T | Promise<T>, details?: HmrTimingDetails) => Promise<T>;
17
+ record: (phase: string, durationMs: number, details?: HmrTimingDetails) => void;
18
+ }
19
+ export declare function shouldEmitHmrTiming(): boolean;
20
+ export declare function emitHmrTiming(bundler: HmrTimingBundler, phase: string, durationMs: number, details?: HmrTimingDetails): void;
21
+ export declare function createHmrTimingRecorder(bundler: HmrTimingBundler): HmrTimingRecorder;
22
+ export {};
@@ -0,0 +1,2 @@
1
+ export declare function stripRequestQuery(request: string): string;
2
+ export declare function isSourceStyleRequest(request: string | undefined): boolean;
@@ -31,6 +31,7 @@ export interface BundleBuildState {
31
31
  runtimeAffectingHashByFile: Map<string, string>;
32
32
  linkedByEntry: Map<string, Set<string>>;
33
33
  dependentsByLinkedFile: Map<string, Set<string>>;
34
+ generatorCandidateSignature?: string | undefined;
34
35
  }
35
36
  interface UpdateBundleBuildStateOptions {
36
37
  incremental?: boolean;
@@ -1,5 +1,6 @@
1
1
  import type { OutputAsset } from 'rollup';
2
2
  import type { Plugin, ResolvedConfig } from 'vite';
3
+ import type { TailwindSourceEntry } from '../../tailwindcss/source-scan';
3
4
  import type { InternalUserDefinedOptions } from '../../types';
4
5
  interface CssFinalizerContext {
5
6
  opts: InternalUserDefinedOptions;
@@ -15,6 +16,7 @@ interface CssFinalizerContext {
15
16
  recordCssAssetResult?: (file: string, css: string) => void;
16
17
  getRecordedGeneratorCandidates?: () => Set<string> | undefined;
17
18
  getSourceCandidates?: () => Set<string>;
19
+ getSourceCandidatesForEntries?: ((entries: TailwindSourceEntry[] | undefined) => Set<string>) | undefined;
18
20
  waitForSourceCandidateSyncs?: () => Promise<void>;
19
21
  rememberMainCssSource?: (file: string, rawSource: string) => void;
20
22
  }
@@ -6,11 +6,15 @@ type CssHandlerOptions = IStyleHandlerOptions & {
6
6
  };
7
7
  };
8
8
  majorVersion: number | undefined;
9
+ sourceOptions?: {
10
+ outputRoot?: string | undefined;
11
+ } | undefined;
9
12
  };
10
13
  interface CssHandlerOptionsCacheOptions {
11
- appType: InternalUserDefinedOptions['appType'];
14
+ getAppType: () => InternalUserDefinedOptions['appType'];
12
15
  mainCssChunkMatcher: InternalUserDefinedOptions['mainCssChunkMatcher'];
13
16
  getMajorVersion: () => number | undefined;
17
+ getOutputRoot?: (() => string | undefined) | undefined;
14
18
  }
15
19
  export interface CssHandlerOptionsCache {
16
20
  getCssHandlerOptions: (file: string) => CssHandlerOptions;
@@ -1,3 +1,4 @@
1
1
  import type { InternalUserDefinedOptions } from '../../../types';
2
+ export declare function createCssTransformShareScope(file: string, rawSource: string): string;
2
3
  export declare function createCssTransformShareScopeKey(opts: InternalUserDefinedOptions, file: string, rawSource: string): string;
3
4
  export declare function createCssRuntimeSignature(runtimeSignature: string, generatorCandidateSignature: string): string;
@@ -1,6 +1,8 @@
1
1
  import type { OutputAsset, OutputChunk } from 'rollup';
2
2
  import type { ResolvedConfig } from 'vite';
3
+ import type { HmrTimingRecorder } from '../shared/hmr-timing';
3
4
  import type { BundleSnapshot } from './bundle-state';
5
+ import type { TailwindSourceEntry } from '../../tailwindcss/source-scan';
4
6
  import type { InternalUserDefinedOptions } from '../../types';
5
7
  interface GenerateBundleContext {
6
8
  opts: InternalUserDefinedOptions;
@@ -9,18 +11,23 @@ interface GenerateBundleContext {
9
11
  readyPromise: Promise<void>;
10
12
  };
11
13
  ensureRuntimeClassSet: (force?: boolean) => Promise<Set<string>>;
12
- ensureBundleRuntimeClassSet: (snapshot: BundleSnapshot, forceRefresh?: boolean) => Promise<Set<string>>;
14
+ ensureBundleRuntimeClassSet: (snapshot: BundleSnapshot, forceRefresh?: boolean, options?: {
15
+ allowBaselineOnlyInitialSync?: boolean | undefined;
16
+ baseClassSet?: Set<string> | undefined;
17
+ }) => Promise<Set<string>>;
13
18
  debug: (format: string, ...args: unknown[]) => void;
14
19
  getResolvedConfig: () => ResolvedConfig | undefined;
15
20
  markCssAssetProcessed?: (asset: OutputAsset, file?: string) => void;
16
21
  recordCssAssetResult?: (file: string, css: string) => void;
17
22
  getSourceCandidates?: () => Set<string>;
23
+ getSourceCandidatesForEntries?: ((entries: TailwindSourceEntry[] | undefined) => Set<string>) | undefined;
18
24
  waitForSourceCandidateSyncs?: () => Promise<void>;
19
25
  rememberMainCssSource?: (file: string, rawSource: string, cssRuntimeSignature: string) => void;
20
26
  getRememberedMainCssSources?: () => Map<string, string>;
21
27
  getRememberedMainCssSignature?: (file: string) => string | undefined;
22
28
  setRememberedMainCssSignature?: (file: string, cssRuntimeSignature: string) => void;
23
29
  recordGeneratorCandidates?: (candidates: Set<string>) => void;
30
+ hmrTimingRecorder?: HmrTimingRecorder;
24
31
  }
25
32
  interface GenerateBundleThis {
26
33
  addWatchFile?: (id: string) => void;
@@ -10,9 +10,13 @@ type ExtractValidCandidatesFn = (options?: MemoryExtractValidCandidatesOptions)
10
10
  type ExtractRawCandidateResult = Awaited<ReturnType<typeof extractRawCandidatesWithPositions>>;
11
11
  type ExtractRawCandidatesFn = (content: string, extension?: string) => Promise<ExtractRawCandidateResult>;
12
12
  export interface BundleRuntimeClassSetManager {
13
- sync: (patcher: TailwindcssPatcherLike, snapshot: BundleSnapshot) => Promise<Set<string>>;
13
+ sync: (patcher: TailwindcssPatcherLike, snapshot: BundleSnapshot, options?: BundleRuntimeClassSetSyncOptions) => Promise<Set<string>>;
14
14
  reset: () => Promise<void>;
15
15
  }
16
+ export interface BundleRuntimeClassSetSyncOptions {
17
+ baseClassSet?: Set<string> | undefined;
18
+ skipInitialFullScanWithBase?: boolean | undefined;
19
+ }
16
20
  interface CreateBundleRuntimeClassSetManagerOptions {
17
21
  extractCandidates?: ExtractValidCandidatesFn;
18
22
  extractRawCandidates?: ExtractRawCandidatesFn;
@@ -1,13 +1,13 @@
1
1
  import type { Plugin } from 'vite';
2
2
  import type { AppType } from '../../types';
3
3
  interface RewriteCssImportsOptions {
4
- appType?: AppType;
5
- getAppType?: () => AppType | undefined;
6
- shouldOwnTailwindGeneration?: boolean;
4
+ appType?: AppType | undefined;
5
+ getAppType?: (() => AppType | undefined) | undefined;
6
+ shouldOwnTailwindGeneration?: boolean | undefined;
7
7
  shouldRewrite: boolean;
8
- rootImport?: string;
8
+ rootImport?: string | undefined;
9
9
  weappTailwindcssDirPosix: string;
10
- onTailwindRootCss?: (id: string, code: string) => Promise<void> | void;
10
+ onTailwindRootCss?: ((id: string, code: string) => Promise<void> | void) | undefined;
11
11
  }
12
12
  export declare function createRewriteCssImportsPlugins(options: RewriteCssImportsOptions): Plugin[];
13
13
  export {};
@@ -17,6 +17,9 @@ 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) => Promise<Set<string>>;
20
+ ensureBundleRuntimeClassSet: (snapshot: BundleSnapshot, forceRefresh?: boolean, options?: {
21
+ allowBaselineOnlyInitialSync?: boolean | undefined;
22
+ baseClassSet?: Set<string> | undefined;
23
+ }) => Promise<Set<string>>;
21
24
  };
22
25
  export {};
@@ -1,17 +1,28 @@
1
1
  import type { TailwindInlineSourceCandidates, TailwindSourceEntry } from '../../tailwindcss/source-scan';
2
2
  export interface SourceCandidateCollector {
3
3
  sync: (id: string, source: string) => Promise<void>;
4
+ merge: (id: string, source: string) => Promise<void>;
4
5
  syncFile: (id: string) => Promise<void>;
5
6
  scanRoot: (options: ScanSourceCandidateRootOptions) => Promise<void>;
6
7
  syncInline: (inlineCandidates: TailwindInlineSourceCandidates | undefined) => void;
7
8
  remove: (id: string) => void;
8
9
  values: () => Set<string>;
10
+ valuesForEntries: (entries: TailwindSourceEntry[] | undefined) => Set<string>;
11
+ snapshot: () => SourceCandidateCollectorSnapshot;
12
+ restore: (snapshot: SourceCandidateCollectorSnapshot) => void;
9
13
  clear: () => void;
10
14
  }
15
+ export interface SourceCandidateCollectorSnapshot {
16
+ candidatesById: Array<[string, string[]]>;
17
+ scanCandidatesById?: Array<[string, string[]]> | undefined;
18
+ transformCandidatesById?: Array<[string, string[]]> | undefined;
19
+ inlineExcludedCandidates: string[];
20
+ inlineIncludedCandidates: string[];
21
+ }
11
22
  interface ScanSourceCandidateRootOptions {
12
23
  root: string;
13
- outDir?: string;
14
- entries?: TailwindSourceEntry[];
24
+ outDir?: string | undefined;
25
+ entries?: TailwindSourceEntry[] | undefined;
15
26
  }
16
27
  export declare function isSourceCandidateRequest(id: string): boolean;
17
28
  export declare function createSourceCandidateCollector(): SourceCandidateCollector;
@@ -1,8 +1,26 @@
1
1
  import type { TailwindInlineSourceCandidates, TailwindSourceEntry } from '../../tailwindcss/source-scan';
2
2
  import type { TailwindcssPatcherLike, UserDefinedOptions } from '../../types';
3
+ export interface ResolvedTailwindV4CssEntries {
4
+ entries: TailwindSourceEntry[];
5
+ explicit: boolean;
6
+ inlineCandidates: TailwindInlineSourceCandidates;
7
+ dependencies: string[];
8
+ }
3
9
  export interface ResolvedViteSourceScan {
4
- entries?: TailwindSourceEntry[];
5
- inlineCandidates?: TailwindInlineSourceCandidates;
10
+ dependencies?: string[] | undefined;
11
+ entries?: TailwindSourceEntry[] | undefined;
12
+ explicit?: boolean | undefined;
13
+ inlineCandidates?: TailwindInlineSourceCandidates | undefined;
14
+ }
15
+ interface ResolveViteSourceScanOptions {
16
+ root?: string | undefined;
17
+ outDir?: string | undefined;
6
18
  }
7
- export declare function resolveViteSourceScanEntries(options: UserDefinedOptions, patcher: TailwindcssPatcherLike): Promise<ResolvedViteSourceScan | undefined>;
19
+ export declare function mergeTailwindInlineSourceCandidates(allInlineCandidates: Array<TailwindInlineSourceCandidates | undefined>): TailwindInlineSourceCandidates | undefined;
20
+ export declare function resolveTailwindV4EntriesFromCss(css: string, base: string): Promise<ResolvedTailwindV4CssEntries | undefined>;
21
+ export declare function resolveViteTailwindV4CssDependencies(css: string, base: string): Promise<string[]>;
22
+ export declare function resolveTailwindV4EntriesFromCssCached(css: string, base: string): Promise<ResolvedTailwindV4CssEntries | undefined>;
23
+ export declare function discoverTailwindV4CssEntries(root: string, outDir: string | undefined): Promise<string[]>;
24
+ export declare function resolveViteSourceScanEntries(options: UserDefinedOptions, patcher: TailwindcssPatcherLike, scanOptions?: ResolveViteSourceScanOptions): Promise<ResolvedViteSourceScan | undefined>;
8
25
  export declare function createViteSourceScanMatcher(entries: TailwindSourceEntry[] | undefined): ((file: string) => boolean) | undefined;
26
+ export {};
@@ -0,0 +1,5 @@
1
+ type StaticContentValue = string | StaticContentValue[] | {
2
+ files: StaticContentValue;
3
+ };
4
+ export declare function readStaticConfigContent(configPath: string): StaticContentValue | undefined;
5
+ export {};
@@ -15,7 +15,12 @@ interface WebpackWatchChangeLike {
15
15
  modifiedFiles?: Set<string>;
16
16
  removedFiles?: Set<string>;
17
17
  }
18
+ interface RuntimeWatchDependenciesLike {
19
+ files?: Iterable<string>;
20
+ contexts?: Iterable<string>;
21
+ }
18
22
  export declare function createAssetHashByChunkMap(chunks: Iterable<ChunkLike>): Map<string, string>;
19
23
  export declare function createRuntimeAwareCssHash(assetHash: string | undefined, sourceHash: string, runtimeSetHash: string): string;
20
24
  export declare function hasWatchChanges(compiler: WebpackWatchChangeLike): boolean;
25
+ export declare function isWatchFileInRuntimeDependencies(file: string, dependencies: RuntimeWatchDependenciesLike): boolean;
21
26
  export {};
@@ -4,7 +4,7 @@ import type { AppType, InternalUserDefinedOptions } from '../../../types';
4
4
  interface SetupWebpackV5ProcessAssetsHookOptions {
5
5
  compiler: Compiler;
6
6
  options: InternalUserDefinedOptions;
7
- appType?: AppType;
7
+ appType?: AppType | undefined;
8
8
  runtimeState: {
9
9
  twPatcher: InternalUserDefinedOptions['twPatcher'];
10
10
  readyPromise: Promise<void>;
@@ -12,8 +12,8 @@ interface SetupWebpackV5ProcessAssetsHookOptions {
12
12
  getRuntimeRefreshRequirement: () => boolean;
13
13
  refreshRuntimeMetadata: (force: boolean) => Promise<void>;
14
14
  consumeRuntimeRefreshRequirement: () => void;
15
- isWatchMode?: () => boolean;
16
- runtimeClassSetManager?: BundleRuntimeClassSetManager;
15
+ isWatchMode?: (() => boolean) | undefined;
16
+ runtimeClassSetManager?: BundleRuntimeClassSetManager | undefined;
17
17
  debug: (format: string, ...args: unknown[]) => void;
18
18
  }
19
19
  export declare function setupWebpackV5ProcessAssetsHook(options: SetupWebpackV5ProcessAssetsHookOptions): void;
@@ -4,11 +4,11 @@ import type { AppType, InternalUserDefinedOptions } from '../../../types';
4
4
  interface SetupWebpackV5LoadersOptions {
5
5
  compiler: Compiler;
6
6
  options: InternalUserDefinedOptions;
7
- appType?: AppType;
7
+ appType?: AppType | undefined;
8
8
  weappTailwindcssPackageDir: string;
9
9
  shouldRewriteCssImports: boolean;
10
- runtimeLoaderPath?: string;
11
- registerAutoCssSource?: (source: TailwindV4CssSource) => Promise<void> | void;
10
+ runtimeLoaderPath?: string | undefined;
11
+ registerAutoCssSource?: ((source: TailwindV4CssSource) => Promise<void> | void) | undefined;
12
12
  getClassSetInLoader: () => Promise<void>;
13
13
  getRuntimeWatchDependencies: () => {
14
14
  files: ReadonlySet<string>;
@@ -9,16 +9,16 @@ export type HashMapKey = string | number;
9
9
  export type CacheValue = sources.Source | string;
10
10
  export interface CacheProcessResult<T extends CacheValue> {
11
11
  result: T;
12
- cacheValue?: CacheValue;
12
+ cacheValue?: CacheValue | undefined;
13
13
  }
14
14
  export interface CacheProcessOptions<T extends CacheValue> {
15
15
  key: string;
16
- hashKey?: HashMapKey;
17
- rawSource?: string | Buffer;
18
- hash?: string;
19
- resolveCache?: () => T | undefined;
16
+ hashKey?: HashMapKey | undefined;
17
+ rawSource?: string | Buffer | undefined;
18
+ hash?: string | undefined;
19
+ resolveCache?: (() => T | undefined) | undefined;
20
20
  transform: () => Promise<CacheProcessResult<T> | T>;
21
- onCacheHit?: (value: T) => void | Promise<void>;
21
+ onCacheHit?: ((value: T) => void | Promise<void>) | undefined;
22
22
  }
23
23
  export interface ICreateCacheReturnType {
24
24
  readonly hashMap: Map<HashMapKey, HashMapValue>;
@@ -1,13 +1,3 @@
1
1
  import type { UserDefinedOptions } from '../types';
2
- export declare function createCliContext(overrides: Partial<UserDefinedOptions> | undefined, resolvedCwd: string | undefined): Required<Omit<UserDefinedOptions, "supportCustomLengthUnitsPatch" | "customReplaceDictionary" | "cache"> & {
3
- supportCustomLengthUnitsPatch: import("tailwindcss-patch").ILengthUnitsPatchOptions | boolean;
4
- templateHandler: (rawSource: string, options?: import("@/types").ITemplateHandlerOptions) => Promise<string>;
5
- styleHandler: (rawSource: string, options?: import("@weapp-tailwindcss/postcss").IStyleHandlerOptions) => Promise<import("postcss").Result<import("postcss").Root | import("postcss").Document>>;
6
- jsHandler: import("@/types").JsHandler;
7
- escapeMap: Record<string, string>;
8
- customReplaceDictionary: Record<string, string>;
9
- cache: import("../cache").ICreateCacheReturnType;
10
- twPatcher: import("@/types").TailwindcssPatcherLike;
11
- refreshTailwindcssPatcher: (options?: import("@/types").RefreshTailwindcssPatcherOptions) => Promise<import("@/types").TailwindcssPatcherLike>;
12
- }>;
2
+ export declare function createCliContext(overrides: Partial<UserDefinedOptions> | undefined, resolvedCwd: string | undefined): import("@/types").InternalUserDefinedOptions;
13
3
  export declare function formatOutputPath(target: string, baseDir?: string): string;